mirror of
https://gitlab.gnome.org/GNOME/gitg
synced 2024-10-14 11:52:29 +00:00
Add platform support methods to get the right dirs
This commit is contained in:
parent
4fc83c3a13
commit
ffb1622e5a
|
@ -24,17 +24,17 @@ public class Dirs
|
|||
{
|
||||
public static string data_dir
|
||||
{
|
||||
get { return Config.GITG_DATADIR; }
|
||||
owned get { return PlatformSupport.get_data_dir(); }
|
||||
}
|
||||
|
||||
public static string locale_dir
|
||||
{
|
||||
get { return Config.GITG_LOCALEDIR; }
|
||||
owned get { return PlatformSupport.get_locale_dir(); }
|
||||
}
|
||||
|
||||
public static string lib_dir
|
||||
{
|
||||
get { return Config.GITG_LIBDIR; }
|
||||
owned get { return PlatformSupport.get_lib_dir(); }
|
||||
}
|
||||
|
||||
public static string plugins_dir
|
||||
|
|
|
@ -17,6 +17,10 @@
|
|||
* along with gitg. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "gitg-platform-support.h"
|
||||
|
||||
#include <gdk/gdkquartz.h>
|
||||
|
@ -167,4 +171,23 @@ gitg_platform_support_new_input_stream_from_fd (gint fd,
|
|||
return g_unix_input_stream_new (fd, close_fd);
|
||||
}
|
||||
|
||||
/* FIXME: probably should use the bundle dirs? */
|
||||
gchar *
|
||||
gitg_platform_support_get_lib_dir (void)
|
||||
{
|
||||
return g_strdup (GITG_LIBDIR);
|
||||
}
|
||||
|
||||
gchar *
|
||||
gitg_platform_support_get_locale_dir (void)
|
||||
{
|
||||
return g_strdup (GITG_LOCALEDIR);
|
||||
}
|
||||
|
||||
gchar *
|
||||
gitg_platform_support_get_data_dir (void)
|
||||
{
|
||||
return g_strdup (GITG_DATADIR);
|
||||
}
|
||||
|
||||
// ex:ts=4 noet
|
||||
|
|
|
@ -61,4 +61,43 @@ gitg_platform_support_new_input_stream_from_fd (gint fd,
|
|||
return g_win32_input_stream_new ((void *)fd, close_fd);
|
||||
}
|
||||
|
||||
gchar *
|
||||
gitg_platform_support_get_lib_dir (void)
|
||||
{
|
||||
gchar *module_dir;
|
||||
gchar *lib_dir;
|
||||
|
||||
module_dir = g_win32_get_package_installation_directory_of_module (NULL);
|
||||
lib_dir = g_build_filename (module_dir, "lib", "gitg", NULL);
|
||||
g_free (module_dir);
|
||||
|
||||
return lib_dir;
|
||||
}
|
||||
|
||||
gchar *
|
||||
gitg_platform_support_get_locale_dir (void)
|
||||
{
|
||||
gchar *module_dir;
|
||||
gchar *locale_dir;
|
||||
|
||||
module_dir = g_win32_get_package_installation_directory_of_module (NULL);
|
||||
locale_dir = g_build_filename (module_dir, "share", "locale", NULL);
|
||||
g_free (module_dir);
|
||||
|
||||
return locale_dir;
|
||||
}
|
||||
|
||||
gchar *
|
||||
gitg_platform_support_get_data_dir (void)
|
||||
{
|
||||
gchar *module_dir;
|
||||
gchar *data_dir;
|
||||
|
||||
module_dir = g_win32_get_package_installation_directory_of_module (NULL);
|
||||
data_dir = g_build_filename (module_dir, "share", "gitg", NULL);
|
||||
g_free (module_dir);
|
||||
|
||||
return data_dir;
|
||||
}
|
||||
|
||||
// ex:ts=4 noet
|
||||
|
|
|
@ -17,6 +17,10 @@
|
|||
* along with gitg. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "gitg-platform-support.h"
|
||||
|
||||
#include <gio/gunixinputstream.h>
|
||||
|
@ -95,4 +99,22 @@ gitg_platform_support_new_input_stream_from_fd (gint fd,
|
|||
return g_unix_input_stream_new (fd, close_fd);
|
||||
}
|
||||
|
||||
gchar *
|
||||
gitg_platform_support_get_lib_dir (void)
|
||||
{
|
||||
return g_strdup (GITG_LIBDIR);
|
||||
}
|
||||
|
||||
gchar *
|
||||
gitg_platform_support_get_locale_dir (void)
|
||||
{
|
||||
return g_strdup (GITG_LOCALEDIR);
|
||||
}
|
||||
|
||||
gchar *
|
||||
gitg_platform_support_get_data_dir (void)
|
||||
{
|
||||
return g_strdup (GITG_DATADIR);
|
||||
}
|
||||
|
||||
// ex:ts=4 noet
|
||||
|
|
|
@ -44,6 +44,12 @@ cairo_surface_t *gitg_platform_support_create_cursor_surface (GdkDisplay *dis
|
|||
GInputStream *gitg_platform_support_new_input_stream_from_fd (gint fd,
|
||||
gboolean close_fd);
|
||||
|
||||
gchar *gitg_platform_support_get_lib_dir (void);
|
||||
|
||||
gchar *gitg_platform_support_get_locale_dir (void);
|
||||
|
||||
gchar *gitg_platform_support_get_data_dir (void);
|
||||
|
||||
#endif /* __GITG_PLATFORM_SUPPORT_H__ */
|
||||
|
||||
// ex:ts=4 noet
|
||||
|
|
|
@ -14,5 +14,9 @@ namespace Gitg
|
|||
out int height = null);
|
||||
|
||||
public static GLib.InputStream new_input_stream_from_fd(int fd, bool close_fd);
|
||||
|
||||
public static string get_lib_dir();
|
||||
public static string get_locale_dir();
|
||||
public static string get_data_dir();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue