diff options
author | ZenWalker <[email protected]> | 2017-02-22 16:12:50 +0100 |
---|---|---|
committer | ZenWalker <[email protected]> | 2017-02-23 20:43:27 +0100 |
commit | 55f055142fdd90a09b80ee4c5c219c108566d7a0 (patch) | |
tree | ef1b4ebcc150aaddfbc063daaa33ee732849bd40 | |
parent | 9970249880237f06d2f718f5168532b93f8d1064 (diff) | |
download | engrampa-55f055142fdd90a09b80ee4c5c219c108566d7a0.tar.bz2 engrampa-55f055142fdd90a09b80ee4c5c219c108566d7a0.tar.xz |
Fix: compress 7z split into volumes
After https://github.com/mate-desktop/engrampa/commit/0b3b7eef61287213308e14639444e1953b52ac04 the compress with volumes doesn't work
This is the fix for 7z files, all the files will be move from the temp folder to the current folder at same time
Fixes partially #127
Fix: compres .tar.7z
-rw-r--r-- | src/fr-process.c | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/src/fr-process.c b/src/fr-process.c index 01f04e0..a2d8898 100644 --- a/src/fr-process.c +++ b/src/fr-process.c @@ -675,14 +675,37 @@ start_current_command (FrProcess *process) char **argv; int out_fd, err_fd; int i = 0; + char *commandline = ""; + gboolean fixname = FALSE; debug (DEBUG_INFO, "%d/%d) ", process->priv->current_command, process->priv->n_comm); info = g_ptr_array_index (process->priv->comm, process->priv->current_command); argv = g_new (char *, g_list_length (info->args) + 1); - for (scan = info->args; scan; scan = scan->next) + + for (scan = info->args; scan; scan = scan->next) { argv[i++] = scan->data; + + if (g_str_has_prefix(commandline, "mv")) { + + if ((i==3) && (!g_file_test(g_shell_quote(argv[2]), G_FILE_TEST_EXISTS)) && (!fixname)) { + + if ((g_str_has_suffix(argv[2], ".7z")) && (!g_str_has_suffix(argv[2], ".tar.7z"))) { + commandline = g_strconcat(commandline, " ", g_shell_quote(argv[2]), "*", NULL); + fixname = TRUE; + } + } + else if ((i==4) && (fixname)) + commandline = g_strconcat(commandline, " \"$(dirname ", g_shell_quote(argv[3]), ")\"", NULL); + else + commandline = g_strconcat(commandline, " ", argv[(i-1)], NULL); + } + else if (g_str_has_prefix(argv[0], "mv")) { + commandline = g_strconcat(commandline, "mv", NULL); + } + } + argv[i] = NULL; #ifdef DEBUG @@ -702,6 +725,11 @@ start_current_command (FrProcess *process) } #endif + if ((fixname) && (system(commandline) != 0)) { + g_warning ("The files could not be move: %s\n", commandline); + return; + } + if (info->begin_func != NULL) (*info->begin_func) (info->begin_data); |