aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2024-07-10 00:21:35 +0200
committerPřemysl Eric Janouch <p@janouch.name>2024-07-10 00:29:49 +0200
commit2e9ea9b4e2a1096e6d6121ced76b73e5b59348d1 (patch)
tree70d6e58c8a56a9e222712930aeaa5f22079bb830
parentb34fe631987b90cf6646271c874f8fa61ed81fbf (diff)
downloadfiv-2e9ea9b4e2a1096e6d6121ced76b73e5b59348d1.tar.gz
fiv-2e9ea9b4e2a1096e6d6121ced76b73e5b59348d1.tar.xz
fiv-2e9ea9b4e2a1096e6d6121ced76b73e5b59348d1.zip
Do not rely on a particular CWD on Windows
on_app_activate() currently makes use of the CWD we are launched with, so I'm choosing to not enforce it globally.
-rw-r--r--fiv-browser.c13
-rw-r--r--fiv-context-menu.c11
2 files changed, 21 insertions, 3 deletions
diff --git a/fiv-browser.c b/fiv-browser.c
index c9963f4..4a904f0 100644
--- a/fiv-browser.c
+++ b/fiv-browser.c
@@ -828,9 +828,18 @@ thumbnailer_next(Thumbnailer *t)
"--thumbnail", fiv_thumbnail_sizes[self->item_size].thumbnail_spec_name,
"--", uri, NULL};
+ GSubprocessLauncher *launcher =
+ g_subprocess_launcher_new(G_SUBPROCESS_FLAGS_STDOUT_PIPE);
+#ifdef G_OS_WIN32
+ gchar *prefix = g_win32_get_package_installation_directory_of_module(NULL);
+ g_subprocess_launcher_set_cwd(launcher, prefix);
+ g_free(prefix);
+#endif
+
GError *error = NULL;
- t->minion = g_subprocess_newv(t->target->icon ? argv_faster : argv_slower,
- G_SUBPROCESS_FLAGS_STDOUT_PIPE, &error);
+ t->minion = g_subprocess_launcher_spawnv(
+ launcher, t->target->icon ? argv_faster : argv_slower, &error);
+ g_object_unref(launcher);
if (error) {
g_warning("%s", error->message);
g_error_free(error);
diff --git a/fiv-context-menu.c b/fiv-context-menu.c
index 16460b6..678c616 100644
--- a/fiv-context-menu.c
+++ b/fiv-context-menu.c
@@ -185,15 +185,24 @@ info_spawn(GtkWidget *dialog, const char *path, GBytes *bytes_in)
if (bytes_in)
flags |= G_SUBPROCESS_FLAGS_STDIN_PIPE;
+ GSubprocessLauncher *launcher = g_subprocess_launcher_new(flags);
+#ifdef G_OS_WIN32
+ // Both to find wperl, and then to let wperl find the nearby exiftool.
+ gchar *prefix = g_win32_get_package_installation_directory_of_module(NULL);
+ g_subprocess_launcher_set_cwd(launcher, prefix);
+ g_free(prefix);
+#endif
+
// TODO(p): Add a fallback to internal capabilities.
// The simplest is to specify the filename and the resolution.
GError *error = NULL;
- GSubprocess *subprocess = g_subprocess_new(flags, &error,
+ GSubprocess *subprocess = g_subprocess_launcher_spawn(launcher, &error,
#ifdef G_OS_WIN32
"wperl",
#endif
"exiftool", "-tab", "-groupNames", "-duplicates", "-extractEmbedded",
"--binary", "-quiet", "--", path, NULL);
+ g_object_unref(launcher);
if (error) {
info_redirect_error(dialog, error);
return;