Index: lib/filesystem/io.js |
=================================================================== |
--- a/lib/filesystem/io.js |
+++ b/lib/filesystem/io.js |
@@ -107,25 +107,26 @@ |
op(); |
}.bind(this); |
- executeWriteOperation(writer.truncate.bind(writer, 0), function() |
+ var blob; |
+ |
+ try |
{ |
- var blob; |
- try |
- { |
- blob = new Blob([data.join(this.lineBreak) + this.lineBreak], {type: "text/plain"}); |
- } |
- catch (e) |
- { |
- if (!(e instanceof TypeError)) |
- throw e; |
+ blob = new Blob([data.join(this.lineBreak) + this.lineBreak], {type: "text/plain"}); |
+ } |
+ catch (e) |
+ { |
+ if (!(e instanceof TypeError)) |
+ throw e; |
- // Blob wasn't a constructor before Chrome 20 |
- var builder = new (window.BlobBuilder || window.WebKitBlobBuilder); |
- builder.append(data.join(this.lineBreak) + this.lineBreak); |
- blob = builder.getBlob("text/plain"); |
- } |
- executeWriteOperation(writer.write.bind(writer, blob), callback.bind(null, null)); |
- }.bind(this)); |
+ // Blob wasn't a constructor before Chrome 20 |
+ var builder = new (window.BlobBuilder || window.WebKitBlobBuilder); |
+ builder.append(data.join(this.lineBreak) + this.lineBreak); |
+ blob = builder.getBlob("text/plain"); |
+ } |
+ executeWriteOperation(writer.write.bind(writer, blob), function() |
+ { |
+ executeWriteOperation(writer.truncate.bind(writer, writer.position), callback.bind(null, null)); |
+ }); |
}.bind(this), callback); |
}.bind(this), callback); |
}, |