From d1d90b0462faa82489e446a6e25337602939993e Mon Sep 17 00:00:00 2001 From: Augustin Cavalier Date: Mon, 1 Jun 2015 20:56:19 -0400 Subject: [PATCH] Zip-O-Matic: fix zipping single folder. Fixes #12027. No clue why this code ever worked. --- .../tracker/zipomatic/ZipperThread.cpp | 30 +++++++------------ 1 file changed, 11 insertions(+), 19 deletions(-) diff --git a/src/add-ons/tracker/zipomatic/ZipperThread.cpp b/src/add-ons/tracker/zipomatic/ZipperThread.cpp index 2a6c690ffd..dfe5d6388c 100644 --- a/src/add-ons/tracker/zipomatic/ZipperThread.cpp +++ b/src/add-ons/tracker/zipomatic/ZipperThread.cpp @@ -93,29 +93,25 @@ ZipperThread::ThreadStartup() gotDirRef = true; } - if (gotDirRef) { - BEntry entry(&dirRef); - BPath path; - entry.GetPath(&path); - chdir(path.Path()); - } else if (sameFolder) { + BString archiveName; + + if (gotDirRef || sameFolder) { BEntry entry(&lastRef); BPath path; entry.GetParent(&entry); entry.GetPath(&path); - chdir(path.Path()); + archiveName = path.Path(); } else { BPath path; if (find_directory(B_DESKTOP_DIRECTORY, &path) == B_OK) - chdir(path.Path()); + archiveName = path.Path(); } - - BString archiveName; + archiveName.Append("/"); if (refCount > 1) - archiveName = B_TRANSLATE("Archive"); + archiveName.Append(B_TRANSLATE("Archive")); else - archiveName = lastRef.name; + archiveName.Append(lastRef.name); int index = 1; for (;; index++) { @@ -144,13 +140,9 @@ ZipperThread::ThreadStartup() for (int index = 0; index < refCount; index++) { fThreadDataStore->FindRef("refs", index, &ref); - if (gotDirRef || sameFolder) { - argv[3 + index] = strdup(ref.name); - } else { - BPath path(&ref); - BString file = path.Path(); - argv[3 + index] = strdup(path.Path()); - } + BPath path(&ref); + BString file = path.Path(); + argv[3 + index] = strdup(path.Path()); } argv[argc] = NULL;