LEFT | RIGHT |
1 /* | 1 /* |
2 * This file is part of Adblock Plus <http://adblockplus.org/>, | 2 * This file is part of Adblock Plus <http://adblockplus.org/>, |
3 * Copyright (C) 2006-2014 Eyeo GmbH | 3 * Copyright (C) 2006-2014 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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 executeWriteOperation(writer.write.bind(writer, blob), callback.bind(n
ull, null)); | 127 executeWriteOperation(writer.write.bind(writer, blob), callback.bind(n
ull, null)); |
128 }.bind(this)); | 128 }.bind(this)); |
129 }.bind(this), callback); | 129 }.bind(this), callback); |
130 }.bind(this), callback); | 130 }.bind(this), callback); |
131 }, | 131 }, |
132 | 132 |
133 copyFile: function(fromFile, toFile, callback) | 133 copyFile: function(fromFile, toFile, callback) |
134 { | 134 { |
135 // Simply combine read and write operations | 135 // Simply combine read and write operations |
136 var data = []; | 136 var data = []; |
137 this.readFromFile(fromFile, false, { | 137 this.readFromFile(fromFile, { |
138 process: function(line) | 138 process: function(line) |
139 { | 139 { |
140 if (line !== null) | 140 if (line !== null) |
141 data.push(line); | 141 data.push(line); |
142 } | 142 } |
143 }, function(e) | 143 }, function(e) |
144 { | 144 { |
145 if (e) | 145 if (e) |
146 callback(e); | 146 callback(e); |
147 else | 147 else |
148 this.writeToFile(toFile, false, data, callback); | 148 this.writeToFile(toFile, data, callback); |
149 }.bind(this)); | 149 }.bind(this)); |
150 }, | 150 }, |
151 | 151 |
152 renameFile: function(fromFile, newName, callback) | 152 renameFile: function(fromFile, newName, callback) |
153 { | 153 { |
154 this._getFileEntry(fromFile, false, function(fs, fileEntry) | 154 this._getFileEntry(fromFile, false, function(fs, fileEntry) |
155 { | 155 { |
156 fileEntry.moveTo(fs.root, newName, function() | 156 fileEntry.moveTo(fs.root, newName, function() |
157 { | 157 { |
158 callback(null); | 158 callback(null); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 callback(null, { | 193 callback(null, { |
194 exists: true, | 194 exists: true, |
195 isDirectory: fileEntry.isDirectory, | 195 isDirectory: fileEntry.isDirectory, |
196 isFile: fileEntry.isFile, | 196 isFile: fileEntry.isFile, |
197 lastModified: metadata.modificationTime.getTime() | 197 lastModified: metadata.modificationTime.getTime() |
198 }); | 198 }); |
199 }, callback); | 199 }, callback); |
200 }, callback); | 200 }, callback); |
201 } | 201 } |
202 }; | 202 }; |
LEFT | RIGHT |