2013-10-31 01:32:12 +04:00
|
|
|
var file;
|
2018-02-28 20:51:33 +03:00
|
|
|
Cu.importGlobalProperties(["File"]);
|
2015-01-27 03:23:00 +03:00
|
|
|
|
2013-10-31 01:32:12 +04:00
|
|
|
addMessageListener("file.create", function (message) {
|
2018-02-28 20:51:33 +03:00
|
|
|
file = Cc["@mozilla.org/file/directory_service;1"]
|
|
|
|
.getService(Ci.nsIProperties)
|
|
|
|
.get("TmpD", Ci.nsIFile);
|
2013-10-31 01:32:12 +04:00
|
|
|
file.append("foo.txt");
|
2018-02-28 20:51:33 +03:00
|
|
|
file.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, 0o600);
|
2017-02-08 12:18:32 +03:00
|
|
|
File.createFromNsIFile(file).then(function(domFile) {
|
|
|
|
sendAsyncMessage("file.created", domFile);
|
|
|
|
});
|
2013-10-31 01:32:12 +04:00
|
|
|
});
|
|
|
|
|
|
|
|
addMessageListener("file.remove", function (message) {
|
|
|
|
file.remove(false);
|
|
|
|
sendAsyncMessage("file.removed", {});
|
|
|
|
});
|