Bug 664832 - Page info should use the same last dir for both single and multiple file saves r=neil a=callek
authorIan Neal <iann_cvs@blueyonder.co.uk>
Sun, 11 Sep 2011 22:58:32 +0100
changeset 8818 26562225175667b429f0a65d54130721cd751a6a
parent 8817 723da19f3ca545505223b54fc1181b0201581af7
child 8819 2d56b3334e86f464943181e7d508a8a5a468acf8
push idunknown
push userunknown
push dateunknown
reviewersneil, callek
bugs664832
Bug 664832 - Page info should use the same last dir for both single and multiple file saves r=neil a=callek
suite/browser/pageinfo/pageInfo.js
--- a/suite/browser/pageinfo/pageInfo.js
+++ b/suite/browser/pageinfo/pageInfo.js
@@ -798,19 +798,23 @@ function selectSaveFolder()
 {
   const nsILocalFile = Components.interfaces.nsILocalFile;
   const nsIFilePicker = Components.interfaces.nsIFilePicker;
   var fp = Components.classes["@mozilla.org/filepicker;1"]
                      .createInstance(nsIFilePicker);
 
   var titleText = gBundle.getString("mediaSelectFolder");
   fp.init(window, titleText, nsIFilePicker.modeGetFolder);
-  var initialDir = GetLocalFilePref("browser.download.dir");
-  if (initialDir)
-    fp.displayDirectory = initialDir;
+  var initialDir = GetLocalFilePref("browser.download.lastDir");
+  if (!initialDir) {
+    let dnldMgr = Components.classes["@mozilla.org/download-manager;1"]
+                            .getService(Components.interfaces.nsIDownloadManager);
+    initialDir = dnldMgr.userDownloadsDirectory;
+  }
+  fp.displayDirectory = initialDir;
 
   fp.appendFilters(nsIFilePicker.filterAll);
   var ret = fp.show();
 
   if (ret == nsIFilePicker.returnOK)
     return fp.file.QueryInterface(nsILocalFile);
   return null;
 }