gecko-dev/xpfe/components/prefwindow/resources/content/prefutilities.js
2000-01-07 06:52:11 +00:00

29 lines
829 B
JavaScript

function getFileOrFolderURL( aTitle, aFolder )
{
try {
var fileSpecWithUI = Components.classes["component://netscape/filespecwithui"].createInstance();
if( fileSpecWithUI )
fileSpecWithUI = fileSpecWithUI.QueryInterface( Components.interfaces.nsIFileSpecWithUI );
/*
var fileSpec = Components.classes["component://netscape/filespec"].createInstance();
if( fileSpec )
fileSpec = fileSpec.QueryInterface( Components.interfaces.nsIFileSpec );*/
}
catch(e) {
dump("*** failed to create fileSpecWithUI or fileSpec objects\n");
return false;
}
try {
if( aFolder )
fileSpecWithUI.path = fileSpecWithUI.chooseDirectory( aTitle );
else
fileSpecWithUI.path = fileSpecWithUI.chooseFile( aTitle );
}
catch(e) {
return -1;
}
return fileSpecWithUI.nativePath;
}