1
0
Fork 0
mirror of https://github.com/betaflight/betaflight-configurator.git synced 2025-07-24 08:45:28 +03:00

Fixed overwriting of existing files in CLI.

This commit is contained in:
mikeller 2017-08-12 23:09:23 +12:00
parent ded170dd7c
commit faeccf833e

View file

@ -48,15 +48,21 @@ TABS.cli.initialize = function (callback) {
return;
}
entry.createWriter(function(writer) {
entry.createWriter(function (writer) {
writer.onerror = function (){
console.error('Failed to write file');
};
writer.onwriteend = function(e) {
console.log('write complete');
};
writer.write(new Blob([self.outputHistory], {type: 'text/plain'}));
},function (){
writer.onwriteend = function () {
if (writer.length === 0) {
writer.write(new Blob([self.outputHistory], {type: 'text/plain'}));
} else {
console.log('write complete');
};
}
writer.truncate(0);
}, function (){
console.error('Failed to get file writer');
});
});