Discuz! Board

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 2069|回复: 1

file

[复制链接]

388

主题

602

帖子

2218

积分

金牌会员

Rank: 6Rank: 6

积分
2218
发表于 2015-10-22 20:16:03 | 显示全部楼层 |阅读模式

    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;

回复

使用道具 举报

388

主题

602

帖子

2218

积分

金牌会员

Rank: 6Rank: 6

积分
2218
 楼主| 发表于 2016-5-18 12:00:55 | 显示全部楼层
本帖最后由 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
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|firemail ( 粤ICP备15085507号-1 )

GMT+8, 2024-4-18 14:04 , Processed in 0.057693 second(s), 19 queries .

Powered by Discuz! X3

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表