diff options
author | ZenWalker <[email protected]> | 2017-02-22 16:12:50 +0100 |
---|---|---|
committer | ZenWalker <[email protected]> | 2017-05-17 13:11:48 +0200 |
commit | ba7632c4206c2f9a2e68658496e1d3c47465ef49 (patch) | |
tree | f216436ef7cdea86de35afde2e5689fefe4953a8 | |
parent | fc6bad0f92a91071e06b8bed9d33f15fa7f8c2bf (diff) | |
download | engrampa-ba7632c4206c2f9a2e68658496e1d3c47465ef49.tar.bz2 engrampa-ba7632c4206c2f9a2e68658496e1d3c47465ef49.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); |