firemail

标题: file [打印本页]

作者: hechengjin    时间: 2015-10-22 20:16
标题: file

    Io.IID_FilePicker = '@mozilla.org/filepicker;1';
    Io.IID_LocalFile = '@mozilla.org/file/local;1';
    Io.IID_InSteam = '@mozilla.org/network/file-input-stream;1';
    Io.IID_InSteamConvert = '@mozilla.org/intl/converter-input-stream;1';
    Io.IID_OutSteam = '@mozilla.org/network/file-output-stream;1';
        Io.IID_OutSteamConvert = '@mozilla.org/intl/converter-output-stream;1';
    Io.IID_DirService = '@mozilla.org/file/directory_service;1';
       
    Io.NORMAL_FILE_TYPE = Components.interfaces.nsIFile.NORMAL_FILE_TYPE;

    Io.IFile = Components.interfaces.nsIFile;
    Io.ILocalFile = Components.interfaces.nsILocalFile;
    Io.IFilePicker = Components.interfaces.nsIFilePicker;
    Io.IInStream = Components.interfaces.nsIFileInputStream;
    Io.IInStreamConverter = Components.interfaces.nsIConverterInputStream;
    Io.IInStreamUnicharLine = Components.interfaces.nsIUnicharLineInputStream;
    Io.IOutStream = Components.interfaces.nsIFileOutputStream;
        Io.IOutStreamConverter = Components.interfaces.nsIConverterOutputStream;


作者: hechengjin    时间: 2016-5-18 12:00
本帖最后由 hechengjin 于 2016-5-18 12:11 编辑

var file = Cc['@mozilla.org/file/directory_service;1'].getService(Ci.nsIProperties).get('ProfD', Ci.nsIFile)

https://dxr.mozilla.org/comm-cen ... m/io/nsIFile.idl#46

https://developer.mozilla.org/en ... _API_in_chrome_code
  1. var dsFile = Components.classes["@mozilla.org/file/directory_service;1"]
  2.                     .getService(Components.interfaces.nsIProperties)
  3.                     .get("ProfD", Components.interfaces.nsIFile);

  4. dsFile.append("myfilename.txt");

  5. var file = File(dsFile);
复制代码
https://dxr.mozilla.org/comm-central/source/mozilla/xpcom/tests/unit/test_localfile.js#14




欢迎光临 firemail (http://firemail.wang:8088/) Powered by Discuz! X3