| OLD | NEW |
| 1 /* | 1 /* |
| 2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
| 3 * Copyright (C) 2006-2015 Eyeo GmbH | 3 * Copyright (C) 2006-2015 Eyeo GmbH |
| 4 * | 4 * |
| 5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
| 6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
| 7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
| 8 * | 8 * |
| 9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 callback(null); | 63 callback(null); |
| 64 }.bind(this)); | 64 }.bind(this)); |
| 65 }, | 65 }, |
| 66 | 66 |
| 67 writeToFile: function(file, data, callback, timeLineID) | 67 writeToFile: function(file, data, callback, timeLineID) |
| 68 { | 68 { |
| 69 var path = this._getFilePath(file); | 69 var path = this._getFilePath(file); |
| 70 this._setFileContents(path, data.join(this.lineBreak) + this.lineBreak, Date
.now()); | 70 this._setFileContents(path, data.join(this.lineBreak) + this.lineBreak, Date
.now()); |
| 71 | 71 |
| 72 var Utils = require("utils").Utils; | 72 var Utils = require("utils").Utils; |
| 73 Utils.runAsync(callback, null, null); | 73 Utils.runAsync(callback.bind(null, null)); |
| 74 }, | 74 }, |
| 75 | 75 |
| 76 copyFile: function(fromFile, toFile, callback) | 76 copyFile: function(fromFile, toFile, callback) |
| 77 { | 77 { |
| 78 // Simply combine read and write operations | 78 // Simply combine read and write operations |
| 79 var data = []; | 79 var data = []; |
| 80 this.readFromFile(fromFile, { | 80 this.readFromFile(fromFile, { |
| 81 process: function(line) | 81 process: function(line) |
| 82 { | 82 { |
| 83 if (line !== null) | 83 if (line !== null) |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 // This needs to use Utils.runAsync(), otherwise FilterStorage might | 120 // This needs to use Utils.runAsync(), otherwise FilterStorage might |
| 121 // initialize too early - see #337. | 121 // initialize too early - see #337. |
| 122 require("utils").Utils.runAsync(callback.bind(null, null, { | 122 require("utils").Utils.runAsync(callback.bind(null, null, { |
| 123 exists: path in ext.storage, | 123 exists: path in ext.storage, |
| 124 isDirectory: false, | 124 isDirectory: false, |
| 125 isFile: true, | 125 isFile: true, |
| 126 lastModified: parseInt(ext.storage[path + "/lastModified"], 10) || 0 | 126 lastModified: parseInt(ext.storage[path + "/lastModified"], 10) || 0 |
| 127 })); | 127 })); |
| 128 } | 128 } |
| 129 }; | 129 }; |
| OLD | NEW |