Browse Source

Patch by phx to support -C in all cases

rdb 11 years ago
parent
commit
fd76cff5f0
1 changed files with 8 additions and 2 deletions
  1. 8 2
      panda/src/downloadertools/multify.cxx

+ 8 - 2
panda/src/downloadertools/multify.cxx

@@ -202,8 +202,8 @@ help() {
 
 
     "  -C <extract_dir>\n"
     "  -C <extract_dir>\n"
 
 
-    "      With -x, change to the named directory before extracting files;\n"
-    "      that is, extract subfiles into the named directory.\n\n"
+    "      Change to the named directory before working on files;\n"
+    "      that is, extraction/creation/update and replace will be based on this path\n\n"
 
 
     "  -O\n"
     "  -O\n"
     "      With -x, extract subfiles to standard output instead of to disk.\n\n"
     "      With -x, extract subfiles to standard output instead of to disk.\n\n"
@@ -419,6 +419,12 @@ add_files(const vector_string &params) {
     filenames.push_back(subfile_name);
     filenames.push_back(subfile_name);
   }
   }
 
 
+  // Change current working directory, if requested.
+  if (got_chdir_to && chdir(chdir_to.c_str()) != 0) {
+    cout << "Failed to chdir to " << chdir_to << ": " << strerror(errno) << endl;
+    return false;
+  }
+
   bool okflag = do_add_files(multifile, filenames);
   bool okflag = do_add_files(multifile, filenames);
 
 
   bool needs_repack = multifile->needs_repack();
   bool needs_repack = multifile->needs_repack();