Kaydet (Commit) 76a9d232 authored tarafından Enrico Tröger's avatar Enrico Tröger

Use g_win32_get_package_installation_directory_of_module() on Windows with newer…

Use g_win32_get_package_installation_directory_of_module() on Windows with newer GLib versions instead of deprecated API.

git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@3654 ea778897-0a13-0410-b9d1-a72fbfd435f5
üst 2bc9e3ae
2009-03-26 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
* src\main.c, src\plugins.c, src\win32.c, src\win32.h:
Use g_win32_get_package_installation_directory_of_module() on Windows
with newer GLib versions instead of deprecated API.
2009-03-25 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de> 2009-03-25 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
* src/build.c: * src/build.c:
......
...@@ -390,7 +390,7 @@ static void setup_paths(void) ...@@ -390,7 +390,7 @@ static void setup_paths(void)
#ifdef G_OS_WIN32 #ifdef G_OS_WIN32
/* use the installation directory(the one where geany.exe is located) as the base for the /* use the installation directory(the one where geany.exe is located) as the base for the
* documentation and data files */ * documentation and data files */
gchar *install_dir = g_win32_get_package_installation_directory(NULL, NULL); gchar *install_dir = win32_get_installation_dir();
data_dir = g_strconcat(install_dir, "\\data", NULL); /* e.g. C:\Program Files\geany\data */ data_dir = g_strconcat(install_dir, "\\data", NULL); /* e.g. C:\Program Files\geany\data */
doc_dir = g_strconcat(install_dir, "\\doc", NULL); doc_dir = g_strconcat(install_dir, "\\doc", NULL);
...@@ -440,7 +440,7 @@ void main_locale_init(const gchar *locale_dir, const gchar *package) ...@@ -440,7 +440,7 @@ void main_locale_init(const gchar *locale_dir, const gchar *package)
#endif #endif
#ifdef G_OS_WIN32 #ifdef G_OS_WIN32
gchar *install_dir = g_win32_get_package_installation_directory(NULL, NULL); gchar *install_dir = win32_get_installation_dir();
/* e.g. C:\Program Files\geany\lib\locale */ /* e.g. C:\Program Files\geany\lib\locale */
l_locale_dir = g_strconcat(install_dir, "\\share\\locale", NULL); l_locale_dir = g_strconcat(install_dir, "\\share\\locale", NULL);
g_free(install_dir); g_free(install_dir);
...@@ -1068,9 +1068,14 @@ gint main(gint argc, gchar **argv) ...@@ -1068,9 +1068,14 @@ gint main(gint argc, gchar **argv)
#endif #endif
#ifdef G_OS_WIN32 #ifdef G_OS_WIN32
/* On Windows, change the working directory to the Geany installation path to not lock {
* the directory of a file passed as command line argument (see bug #2626124). */ gchar *dir;
win32_set_working_directory(g_win32_get_package_installation_directory(NULL, NULL)); /* On Windows, change the working directory to the Geany installation path to not lock
* the directory of a file passed as command line argument (see bug #2626124). */
dir = win32_get_installation_dir();
win32_set_working_directory(dir);
g_free(dir);
}
#endif #endif
/*g_timeout_add(0, (GSourceFunc)destroyapp, NULL);*/ /* useful for start time tests*/ /*g_timeout_add(0, (GSourceFunc)destroyapp, NULL);*/ /* useful for start time tests*/
......
...@@ -60,6 +60,7 @@ ...@@ -60,6 +60,7 @@
#include "toolbar.h" #include "toolbar.h"
#include "stash.h" #include "stash.h"
#include "keyfile.h" #include "keyfile.h"
#include "win32.h"
#ifdef G_OS_WIN32 #ifdef G_OS_WIN32
...@@ -803,10 +804,11 @@ load_plugins_from_path(const gchar *path) ...@@ -803,10 +804,11 @@ load_plugins_from_path(const gchar *path)
#ifdef G_OS_WIN32 #ifdef G_OS_WIN32
static gchar *get_plugin_path() static gchar *get_plugin_path()
{ {
gchar *install_dir = g_win32_get_package_installation_directory(NULL, NULL); gchar *install_dir = win32_get_installation_dir();
gchar *path; gchar *path;
path = g_strconcat(install_dir, "\\lib", NULL); path = g_strconcat(install_dir, "\\lib", NULL);
g_free(install_dir);
return path; return path;
} }
......
...@@ -1188,4 +1188,13 @@ void win32_set_working_directory(const gchar *dir) ...@@ -1188,4 +1188,13 @@ void win32_set_working_directory(const gchar *dir)
SetCurrentDirectory(dir); SetCurrentDirectory(dir);
} }
gchar *win32_get_installation_dir(void)
{
#if GLIB_CHECK_VERSION(2, 16, 0)
return g_win32_get_package_installation_directory_of_module(NULL);
#else
return g_win32_get_package_installation_directory(NULL, NULL);
#endif
}
#endif #endif
...@@ -61,4 +61,6 @@ gboolean win32_spawn(const gchar *dir, gchar **argv, gchar **env, GSpawnFlags fl ...@@ -61,4 +61,6 @@ gboolean win32_spawn(const gchar *dir, gchar **argv, gchar **env, GSpawnFlags fl
gchar *win32_get_shortcut_target(const gchar *file_name); gchar *win32_get_shortcut_target(const gchar *file_name);
gchar *win32_get_installation_dir(void);
#endif #endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment