【问题标题】:Safe location to write a file from a Firefox extension?从 Firefox 扩展写入文件的安全位置?
【发布时间】:2011-12-14 04:17:45
【问题描述】:

我正在开发一个使用本地 .xml 文件的 Firefox 扩展程序,它可以读写它。

我的代码没有问题,它可以在我的电脑上使用桌面目录进行测试,但我不知道在最终扩展上使用哪个文件夹,因为它在尝试编写时可能会遇到权限问题一些电脑上的文件。

在 mozilla.org 上,我看到了可以使用的这些目录:

String  Meaning
ProfD   profile directory
DefProfRt   user (for example /root/.mozilla)
UChrm   %profile%/chrome
DefRt   %installation%/defaults
PrfDef  %installation%/defaults/pref
ProfDefNoLoc    %installation%/defaults/profile
APlugns     %installation%/plugins
AChrom  %installation%/chrome
ComsD   %installation%/components
CurProcD    installation (usually)
Home    OS root (for example /root)
TmpD    OS tmp (for example /tmp)
ProfLD  Local Settings on windows; where the network cache and fastload files are stored
resource:app    application directory in a XULRunner app
Desk    Desktop directory (for example ~/Desktop on Linux, C:\Documents and Settings\username\Desktop on Windows)
Progs   User start menu programs directory (for example C:\Documents and Settings\username\Start Menu\Programs)

有人知道哪个是用于发布发布的最佳选择吗?我的意思是所有可用文件夹中的哪一个将始终在任何电脑上具有写入权限?

【问题讨论】:

    标签: firefox firefox-addon firefox4


    【解决方案1】:

    扩展通常应该只写入用户的配置文件目录 (ProfD)。如果您有多个文件,您可能最好在那里为您的扩展创建一个目录。如果它是单个文件 - 请确保以一种明确的方式命名它属于哪个扩展名。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-04-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多