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:
parent
ded170dd7c
commit
faeccf833e
1 changed files with 12 additions and 6 deletions
18
tabs/cli.js
18
tabs/cli.js
|
@ -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');
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue