Skip to content

Commit

Permalink
use Blob instead of deprecated BlobBuilder, fix a bug with cordova Fi…
Browse files Browse the repository at this point in the history
…le.write
  • Loading branch information
maxme committed Jan 23, 2013
1 parent bfb59e1 commit b4d69e4
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions lib/client/platform/cordova/2.0.0/bridge/file.js
Original file line number Diff line number Diff line change
Expand Up @@ -240,15 +240,14 @@ module.exports = {
text = args[1],
position = args[2],
sourcepath,
BB = window.BlobBuilder || window.WebKitBlobBuilder,
bb = new BB();
blob;

// Format source path
sourcepath = ((file.fullPath ? file.fullPath : '') + file.name);
sourcepath = cleanPath(sourcepath);

// Create a blob for the text to be written
bb.append(text);
blob = new Blob([text]);

// Get the FileEntry, create if necessary
fs.root.getFile(sourcepath, {create: true}, function (entry) {
Expand All @@ -264,7 +263,7 @@ module.exports = {
if (position && position > 0) {
writer.seek(position);
}
writer.write(bb.getBlob('text/plain'));
writer.write(blob);
}, function (err) {
if (fail) fail(err.code);
});
Expand Down

0 comments on commit b4d69e4

Please sign in to comment.