Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: lib/io.js

Issue 29453555: Issue 5285 - Fix saving filters on clean Thunderbird or SeaMonkey profiles (Closed) Base URL: https://hg.adblockplus.org/adblockplus
Patch Set: Created June 1, 2017, 9:15 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/io.js
===================================================================
--- a/lib/io.js
+++ b/lib/io.js
@@ -71,32 +71,43 @@ function callLegacy(method, ...args)
function legacyFile(fileName)
{
let file = LegacyIO.resolveFilePath("adblockplus");
file.append(fileName);
return file;
}
+function ensureDirExists(file)
+{
+ if (!file.exists())
+ {
+ ensureDirExists(file.parent);
+ file.create(Ci.nsIFile.DIRECTORY_TYPE, 0o755);
+ }
+}
+
let fallback = {
readFromFile(fileName, listener)
{
let wrapper = {
process(line)
{
if (line !== null)
listener(line);
}
};
return callLegacy("readFromFile", legacyFile(fileName), wrapper);
},
writeToFile(fileName, data)
{
- return callLegacy("writeToFile", legacyFile(fileName), data);
+ let file = legacyFile(fileName);
+ ensureDirExists(file.parent);
Wladimir Palant 2017/06/01 09:16:41 For reference, this operation was originally being
+ return callLegacy("writeToFile", file, data);
},
copyFile(fromFile, toFile)
{
return callLegacy("copyFile", legacyFile(fromFile), legacyFile(toFile));
},
renameFile(fromFile, newName)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld