SF.net SVN: geany:[3596] trunk

eht16 at users.sourceforge.net eht16 at xxxxx
Tue Feb 24 18:26:17 UTC 2009


Revision: 3596
          http://geany.svn.sourceforge.net/geany/?rev=3596&view=rev
Author:   eht16
Date:     2009-02-24 18:26:16 +0000 (Tue, 24 Feb 2009)

Log Message:
-----------
On Windows, change the working directory to the Geany installation path at startup to avoid unwanted directory locking(closes #2626124).

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/src/main.c
    trunk/src/win32.c
    trunk/src/win32.h

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2009-02-24 18:25:57 UTC (rev 3595)
+++ trunk/ChangeLog	2009-02-24 18:26:16 UTC (rev 3596)
@@ -6,6 +6,9 @@
  * src/msgwindow.c:
    Fix missing NULL checks when reading the colour value of compiler
    output messages.
+ * src/main.c, src/win32.c, src/win32.h:
+   On Windows, change the working directory to the Geany installation
+   path at startup to avoid unwanted directory locking(closes #2626124).
 
 
 2009-02-20  Frank Lanitz  <frank(at)frank(dot)uvena(dot)de>

Modified: trunk/src/main.c
===================================================================
--- trunk/src/main.c	2009-02-24 18:25:57 UTC (rev 3595)
+++ trunk/src/main.c	2009-02-24 18:26:16 UTC (rev 3596)
@@ -1056,6 +1056,12 @@
 	}
 #endif
 
+#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). */
+	win32_set_working_directory(g_win32_get_package_installation_directory(NULL, NULL));
+#endif
+
 	/*g_timeout_add(0, (GSourceFunc)destroyapp, NULL);*/ /* useful for start time tests*/
 	gtk_main();
 	return 0;

Modified: trunk/src/win32.c
===================================================================
--- trunk/src/win32.c	2009-02-24 18:25:57 UTC (rev 3595)
+++ trunk/src/win32.c	2009-02-24 18:26:16 UTC (rev 3596)
@@ -703,7 +703,7 @@
 }
 
 
-void win32_init_debug_code()
+void win32_init_debug_code(void)
 {
 	if (app->debug_mode)
 	{
@@ -716,7 +716,7 @@
 }
 
 
-gchar *win32_get_hostname()
+gchar *win32_get_hostname(void)
 {
 	gchar hostname[100];
 	DWORD size = sizeof(hostname);
@@ -1183,5 +1183,9 @@
 		return path;
 }
 
+void win32_set_working_directory(const gchar *dir)
+{
+	SetCurrentDirectory(dir);
+}
 
 #endif

Modified: trunk/src/win32.h
===================================================================
--- trunk/src/win32.h	2009-02-24 18:25:57 UTC (rev 3595)
+++ trunk/src/win32.h	2009-02-24 18:26:16 UTC (rev 3596)
@@ -48,10 +48,12 @@
 
 gint win32_check_write_permission(const gchar *dir);
 
-void win32_init_debug_code();
+void win32_init_debug_code(void);
 
-gchar *win32_get_hostname();
+void win32_set_working_directory(const gchar *dir);
 
+gchar *win32_get_hostname(void);
+
 gboolean win32_get_exit_status(GPid child_pid);
 
 gboolean win32_spawn(const gchar *dir, gchar **argv, gchar **env, GSpawnFlags flags,


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the Commits mailing list