rem: textInput = document.getElementById("textInput");  var file = Components.classes[nsILocalFile_PROGID].createInstance(nsILocalFile); file.initWithPath(textInput.value); 
context: function onOK(){  var ret = nsIFilePicker.returnCancel;  textInput = document.getElementById("textInput");  var file = Components.classes[nsILocalFile_PROGID].createInstance(nsILocalFile);  file.initWithPath(textInput.value);  var isDir = false;  var isFile = false;  if (file.exists()) {    isDir = file.isDirectory();    isFile = file.isFile();  } else {    /* look for something in our current directory */    var nfile = sfile.clone().QueryInterface(nsILocalFile);    if (file.path[0] == '/')   /* an absolute path was entered */      nfile.initWithPath(file.path)    else      nfile.appendRelativePath(file.path);    /*    dump(nfile.path); */    if (nfile.exists()) {      file = nfile;    } else {      if (filePickerMode == nsIFilePicker.modeSave)        file = nfile;      else        file = null;    }  }  if (!file)    return false;  if (file.exists()) {    var isDir = file.isDirectory();    var isFile = file.isFile();  } else { /* we are saving a new file */    isDir = false;    isFile = false;  }  switch(filePickerMode) {  case nsIFilePicker.modeOpen:    if (isFile) {      retvals.directory = file.parent.path;      ret = nsIFilePicker.returnOK;    } else if (isDir) {      if (!sfile.equals(file)) {        gotoDirectory(file.path);      }      ret = nsIFilePicker.returnCancel;    }    break;  case nsIFilePicker.modeSave:    if (isFile) {      // we need to pop up a dialog asking if you want to save      rv = window.confirm(file.path + " " + bundle.GetStringFromName("confirmFileReplacing"));      if (rv)        ret = nsIFilePicker.returnReplace;      else        ret = nsIFilePicker.returnCancel;      retvals.directory = file.parent.path;    } else if (!file.exists()) {      ret = nsIFilePicker.returnOK;      retvals.directory = file.parent.path;    }    break;  case nsIFilePicker.modeGetFolder:    if (isDir) {      retvals.directory = file.parent.path;      ret = nsIFilePicker.returnOK;    }    break;  }  retvals.file = file;  retvals.buttonStatus = ret;  if (ret == nsIFilePicker.returnCancel)    return false;  else    return true;}
meta: 9421	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/9421/b105a9dcb9e30adbe8961f8c5e2bb52ecceeeaee/filepicker.js/buggy/xpfe/components/filepicker/res/content/filepicker.js