Branch: refs/heads/1.23 Author: unknown enrico.troeger@uvena.de Committer: unknown enrico.troeger@uvena.de Date: Sat, 18 May 2013 13:45:18 UTC Commit: eea7ffbff0c5bf14a9662483d989c4213f1392f7 https://github.com/geany/geany/commit/eea7ffbff0c5bf14a9662483d989c4213f1392...
Log Message: ----------- Fix #3613096 by remembering the directory Geany was started from
This is one for more workaround for the current directory handling on Windows: we now remember the directory from which Geany was started to use this to resolve relative paths used to load files from the command line.
Modified Paths: -------------- src/main.c
Modified: src/main.c 10 files changed, 9 insertions(+), 1 deletions(-) =================================================================== @@ -91,6 +91,7 @@ GeanyStatus main_status; CommandLineOptions cl_options; /* fields initialised in parse_command_line_options */
+static gchar *original_cwd = NULL;
static const gchar geany_lib_versions[] = "GTK %u.%u.%u, GLib %u.%u.%u";
@@ -310,7 +311,11 @@ gchar *main_get_argv_filename(const gchar *filename) else { /* use current dir */ - gchar *cur_dir = g_get_current_dir(); + gchar *cur_dir = NULL; + if (original_cwd == NULL) + cur_dir = g_get_current_dir(); + else + cur_dir = g_strdup(original_cwd);
result = g_strjoin( G_DIR_SEPARATOR_S, cur_dir, filename, NULL); @@ -379,6 +384,8 @@ static void get_line_and_column_from_filename(gchar *filename, gint *line, gint #ifdef G_OS_WIN32 static void change_working_directory_on_windows(const gchar *install_dir) { + /* remember original working directory for use with opening files from the command line */ + original_cwd = g_get_current_dir(); /* 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). * This also helps if plugins or other code uses relative paths to load @@ -1309,6 +1316,7 @@ void main_quit() g_object_unref(geany_object); geany_object = NULL;
+ g_free(original_cwd); g_free(app);
ui_finalize_builder();
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).