зеркало из https://github.com/mozilla/pjs.git
Bug 41409 - make unix filepicker start out in home directory instead of root directory. r=pavlov.
This commit is contained in:
Родитель
8090990752
Коммит
cad7434ce7
|
@ -3,6 +3,8 @@
|
|||
const nsILocalFile = Components.interfaces.nsILocalFile;
|
||||
const nsILocalFile_PROGID = "component://mozilla/file/local";
|
||||
const nsIFilePicker = Components.interfaces.nsIFilePicker;
|
||||
const nsIDirectoryServiceProvider = Components.interfaces.nsIDirectoryServiceProvider;
|
||||
const nsIDirectoryServiceProvider_PROGID = "component://netscape/file/directory_service";
|
||||
|
||||
var sfile = Components.classes[nsILocalFile_PROGID].createInstance(nsILocalFile);
|
||||
var retvals;
|
||||
|
@ -51,7 +53,11 @@ function onLoad() {
|
|||
if (directory) {
|
||||
sfile.initWithPath(directory);
|
||||
} else {
|
||||
sfile.initWithPath("/");
|
||||
// Start in the user's home directory
|
||||
var dirServiceProvider = Components.classes[nsIDirectoryServiceProvider_PROGID].getService().QueryInterface(nsIDirectoryServiceProvider);
|
||||
var persistent = new Object();
|
||||
var homeDir = dirServiceProvider.getFile("system.HomeDirectory", persistent);
|
||||
sfile.initWithPath(homeDir.path);
|
||||
}
|
||||
|
||||
retvals.buttonStatus = nsIFilePicker.returnCancel;
|
||||
|
|
Загрузка…
Ссылка в новой задаче