Bug 41409 - make unix filepicker start out in home directory instead of root directory. r=pavlov.

This commit is contained in:
bryner%uiuc.edu 2000-07-31 03:41:18 +00:00
Родитель 8090990752
Коммит cad7434ce7
1 изменённых файлов: 7 добавлений и 1 удалений

Просмотреть файл

@ -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;