Kaydet (Commit) bff71b3a authored tarafından Matthew Brush's avatar Matthew Brush

Fix "Open in New Window" command arguments

Closes #590
üst 1b5ec633
...@@ -2154,24 +2154,29 @@ const gchar *utils_resource_dir(GeanyResourceDirType type) ...@@ -2154,24 +2154,29 @@ const gchar *utils_resource_dir(GeanyResourceDirType type)
void utils_start_new_geany_instance(const gchar *doc_path) void utils_start_new_geany_instance(const gchar *doc_path)
{ {
const gchar *const *argv;
const gchar *command = is_osx_bundle() ? "open" : "geany"; const gchar *command = is_osx_bundle() ? "open" : "geany";
gchar *exec_path = g_find_program_in_path(command); gchar *exec_path = g_find_program_in_path(command);
if (exec_path) if (exec_path)
{ {
GError *err = NULL; GError *err = NULL;
const gchar *argv[6]; // max args + 1
gint argc = 0;
argv[argc++] = exec_path;
if (is_osx_bundle()) if (is_osx_bundle())
{ {
const gchar *const osx_argv[] = {exec_path, "-n", "-a", "Geany", doc_path, NULL}; argv[argc++] = "-n";
argv = osx_argv; argv[argc++] = "-a";
argv[argc++] = "Geany";
argv[argc++] = doc_path;
} }
else else
{ {
const gchar *const unix_argv[] = {exec_path, "-i", doc_path, NULL}; argv[argc++] = "-i";
argv = unix_argv; argv[argc++] = doc_path;
} }
argv[argc] = NULL;
if (!utils_spawn_async(NULL, (gchar**) argv, NULL, 0, NULL, NULL, NULL, &err)) if (!utils_spawn_async(NULL, (gchar**) argv, NULL, 0, NULL, NULL, NULL, &err))
{ {
......
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