Implement default configuration files on Windows

This commit is contained in:
Peter de Ridder 2010-06-26 15:38:37 +02:00 committed by Christian Dywan
parent 63fce62664
commit a84a077ac8
2 changed files with 20 additions and 2 deletions

View file

@ -1455,17 +1455,27 @@ sokoke_find_config_filename (const gchar* folder,
const gchar* const* config_dirs = g_get_system_config_dirs (); const gchar* const* config_dirs = g_get_system_config_dirs ();
guint i = 0; guint i = 0;
const gchar* config_dir; const gchar* config_dir;
gchar* path;
if (!folder) if (!folder)
folder = ""; folder = "";
while ((config_dir = config_dirs[i++])) while ((config_dir = config_dirs[i++]))
{ {
gchar* path = g_build_filename (config_dir, PACKAGE_NAME, folder, filename, NULL); path = g_build_filename (config_dir, PACKAGE_NAME, folder, filename, NULL);
if (g_access (path, F_OK) == 0) if (g_access (path, F_OK) == 0)
return path; return path;
g_free (path); g_free (path);
} }
#ifdef G_OS_WIN32
config_dir = g_win32_get_package_installation_directory_of_module (NULL);
path = g_build_filename (config_dir, "etc", "xdg", PACKAGE_NAME, folder, filename, NULL);
if (g_access (path, F_OK) == 0)
return path;
g_free (path);
#endif
return g_build_filename (SYSCONFDIR, "xdg", PACKAGE_NAME, folder, filename, NULL); return g_build_filename (SYSCONFDIR, "xdg", PACKAGE_NAME, folder, filename, NULL);
} }

10
wscript
View file

@ -503,7 +503,15 @@ def build (bld):
bld.install_files ('${MDATADIR}/' + APPNAME + '/res', 'data/autosuggestcontrol.css') bld.install_files ('${MDATADIR}/' + APPNAME + '/res', 'data/autosuggestcontrol.css')
# FIXME: Determine the library naming for other platforms # FIXME: Determine the library naming for other platforms
if Options.platform == 'linux': if bld.env['platform'] == 'win32':
extensions = os.listdir ('data/extensions')
for extension in extensions:
folder = 'lib' + extension + '.dll'
source = 'data/extensions/' + extension + '/config'
if os.path.exists (source):
bld.install_files ('${SYSCONFDIR}/xdg/' + APPNAME + \
'/extensions/' + folder, source)
elif Options.platform == 'linux':
extensions = os.listdir ('data/extensions') extensions = os.listdir ('data/extensions')
for extension in extensions: for extension in extensions:
folder = 'lib' + extension + '.so' folder = 'lib' + extension + '.so'