summaryrefslogtreecommitdiff
path: root/plugins/converter
diff options
context:
space:
mode:
authorGravatar waker <wakeroid@gmail.com>2012-10-10 22:28:54 +0200
committerGravatar waker <wakeroid@gmail.com>2012-10-10 22:28:54 +0200
commit406a77d1bd10e09e448a2ef80b88e59669794b11 (patch)
treeae6ce0ddf2a1eab30d00ab4f5c8fbc76bc159ee3 /plugins/converter
parent6931db2917c095fbeab43cc439f51a400c810dd1 (diff)
converter: fixed file-exists check
Diffstat (limited to 'plugins/converter')
-rw-r--r--plugins/converter/convgui.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/plugins/converter/convgui.c b/plugins/converter/convgui.c
index e225c74d..89a341f1 100644
--- a/plugins/converter/convgui.c
+++ b/plugins/converter/convgui.c
@@ -181,8 +181,22 @@ converter_worker (void *ctx) {
converter_plugin->get_output_path (conv->convert_items[n], conv->outfolder, conv->outfile, conv->encoder_preset, conv->preserve_folder_structure, root, conv->write_to_source_folder, outpath, sizeof (outpath));
int skip = 0;
+
+ // need to unescape path before passing to stat
+ char unesc_path[2000];
+ char invalid[] = "$\"`\\";
+ const char *p = outpath;
+ char *o = unesc_path;
+ while (*p) {
+ if (*p == '\\') {
+ p++;
+ }
+ *o++ = *p++;
+ }
+ *o = 0;
+
struct stat st;
- int res = stat(outpath, &st);
+ int res = stat(unesc_path, &st);
if (res == 0) {
if (conv->overwrite_action > 1 || conv->overwrite_action < 0) {
conv->overwrite_action = 0;
@@ -192,7 +206,7 @@ converter_worker (void *ctx) {
struct overwrite_prompt_ctx ctl;
ctl.mutex = deadbeef->mutex_create ();
ctl.cond = deadbeef->cond_create ();
- ctl.fname = outpath;
+ ctl.fname = unesc_path;
ctl.result = 0;
gdk_threads_add_idle (overwrite_prompt_cb, &ctl);
deadbeef->cond_wait (ctl.cond, ctl.mutex);