[geany/geany] bff71b: Fix "Open in New Window" command arguments

Matthew Brush git-noreply at xxxxx
Tue Aug 4 00:04:52 UTC 2015


Branch:      refs/heads/master
Author:      Matthew Brush <matt at geany.org>
Committer:   Matthew Brush <matt at geany.org>
Date:        Tue, 04 Aug 2015 00:04:52 UTC
Commit:      bff71b3a88f6fc77a32a642d8d638ed91742ce98
             https://github.com/geany/geany/commit/bff71b3a88f6fc77a32a642d8d638ed91742ce98

Log Message:
-----------
Fix "Open in New Window" command arguments

Closes #590


Modified Paths:
--------------
    src/utils.c

Modified: src/utils.c
15 lines changed, 10 insertions(+), 5 deletions(-)
===================================================================
@@ -2154,24 +2154,29 @@ const gchar *utils_resource_dir(GeanyResourceDirType type)
 
 void utils_start_new_geany_instance(const gchar *doc_path)
 {
-	const gchar *const *argv;
 	const gchar *command = is_osx_bundle() ? "open" : "geany";
 	gchar *exec_path = g_find_program_in_path(command);
 
 	if (exec_path)
 	{
 		GError *err = NULL;
+		const gchar *argv[6]; // max args + 1
+		gint argc = 0;
 
+		argv[argc++] = exec_path;
 		if (is_osx_bundle())
 		{
-			const gchar *const osx_argv[] = {exec_path, "-n", "-a", "Geany", doc_path, NULL};
-			argv = osx_argv;
+			argv[argc++] = "-n";
+			argv[argc++] = "-a";
+			argv[argc++] = "Geany";
+			argv[argc++] = doc_path;
 		}
 		else
 		{
-			const gchar *const unix_argv[] = {exec_path, "-i", doc_path, NULL};
-			argv = unix_argv;
+			argv[argc++] = "-i";
+			argv[argc++] = doc_path;
 		}
+		argv[argc] = NULL;
 
 		if (!utils_spawn_async(NULL, (gchar**) argv, NULL, 0, NULL, NULL, NULL, &err))
 		{



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Commits mailing list