summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrbuj <[email protected]>2021-02-25 11:39:21 +0100
committerraveit65 <[email protected]>2021-03-11 22:39:25 +0100
commit73da71ed6a7ce2e5e5811b522c2f21a823f5f26d (patch)
tree28c7010d6e10b2e551afc74c6379292079c3a08d
parent3ed9a7d14a005667103935185cc6d1daec8ecbee (diff)
downloadcaja-extensions-73da71ed6a7ce2e5e5811b522c2f21a823f5f26d.tar.bz2
caja-extensions-73da71ed6a7ce2e5e5811b522c2f21a823f5f26d.tar.xz
image-converter: remove hardcoded filepath to convert (portability)
-rw-r--r--image-converter/caja-image-resizer.c7
-rw-r--r--image-converter/caja-image-rotator.c7
2 files changed, 10 insertions, 4 deletions
diff --git a/image-converter/caja-image-resizer.c b/image-converter/caja-image-resizer.c
index 02484c1..f9ce576 100644
--- a/image-converter/caja-image-resizer.c
+++ b/image-converter/caja-image-resizer.c
@@ -258,7 +258,7 @@ run_op (CajaImageResizer *resizer)
/* FIXME: check whether new_uri already exists and provide "Replace _All", "_Skip", and "_Replace" options */
gchar *argv[6];
- argv[0] = "/usr/bin/convert";
+ argv[0] = "convert";
argv[1] = filename;
argv[2] = "-resize";
argv[3] = resizer->size;
@@ -267,8 +267,11 @@ run_op (CajaImageResizer *resizer)
pid_t pid;
- if (!g_spawn_async (NULL, argv, NULL, G_SPAWN_DO_NOT_REAP_CHILD, NULL, NULL, &pid, NULL)) {
+ if (filename == NULL || new_filename == NULL ||
+ !g_spawn_async (NULL, argv, NULL, G_SPAWN_SEARCH_PATH | G_SPAWN_DO_NOT_REAP_CHILD, NULL, NULL, &pid, NULL)) {
// FIXME: error handling
+ g_free (filename);
+ g_free (new_filename);
return;
}
diff --git a/image-converter/caja-image-rotator.c b/image-converter/caja-image-rotator.c
index a46901b..256fb76 100644
--- a/image-converter/caja-image-rotator.c
+++ b/image-converter/caja-image-rotator.c
@@ -254,7 +254,7 @@ run_op (CajaImageRotator *rotator)
/* FIXME: check whether new_uri already exists and provide "Replace _All", "_Skip", and "_Replace" options */
gchar *argv[8];
- argv[0] = "/usr/bin/convert";
+ argv[0] = "convert";
argv[1] = filename;
argv[2] = "-rotate";
argv[3] = rotator->angle;
@@ -265,8 +265,11 @@ run_op (CajaImageRotator *rotator)
pid_t pid;
- if (!g_spawn_async (NULL, argv, NULL, G_SPAWN_DO_NOT_REAP_CHILD, NULL, NULL, &pid, NULL)) {
+ if (filename == NULL || new_filename == NULL ||
+ !g_spawn_async (NULL, argv, NULL, G_SPAWN_DO_NOT_REAP_CHILD | G_SPAWN_SEARCH_PATH, NULL, NULL, &pid, NULL)) {
// FIXME: error handling
+ g_free (filename);
+ g_free (new_filename);
return;
}