|
|
|
@ -725,12 +725,12 @@ class FileManager extends Plugin { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
syncEditor (path) { |
|
|
|
|
async syncEditor (path) { |
|
|
|
|
var currentFile = this._deps.config.get('currentFile') |
|
|
|
|
if (path !== currentFile) return |
|
|
|
|
var provider = this.fileProviderOf(currentFile) |
|
|
|
|
if (provider) { |
|
|
|
|
provider.get(currentFile, (error, content) => { |
|
|
|
|
await provider.get(currentFile, (error, content) => { |
|
|
|
|
if (error) console.log(error) |
|
|
|
|
this.editor.setText(content) |
|
|
|
|
}) |
|
|
|
@ -739,22 +739,18 @@ class FileManager extends Plugin { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
setBatchFiles (filesSet, fileProvider, override, callback) { |
|
|
|
|
async setBatchFiles (filesSet, fileProvider, override, callback) { |
|
|
|
|
const self = this |
|
|
|
|
if (!fileProvider) fileProvider = 'browser' |
|
|
|
|
if (!fileProvider) fileProvider = 'workspace' |
|
|
|
|
if (override === undefined) override = false |
|
|
|
|
|
|
|
|
|
async.each(Object.keys(filesSet), async (file, callback) => { |
|
|
|
|
for (const file of Object.keys(filesSet)) { |
|
|
|
|
if (override) { |
|
|
|
|
try { |
|
|
|
|
await self._deps.filesProviders[fileProvider].set(file, filesSet[file].content) |
|
|
|
|
} catch (e) { |
|
|
|
|
return callback(e.message || e) |
|
|
|
|
} |
|
|
|
|
self.syncEditor(fileProvider + file) |
|
|
|
|
return callback() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
await self._deps.filesProviders[fileProvider].set(file, filesSet[file].content, (e) => { |
|
|
|
|
if (e) callback(e.message || e) |
|
|
|
|
}) |
|
|
|
|
await self.syncEditor(fileProvider + file) |
|
|
|
|
} else { |
|
|
|
|
helper.createNonClashingName(file, self._deps.filesProviders[fileProvider], |
|
|
|
|
async (error, name) => { |
|
|
|
|
if (error) { |
|
|
|
@ -768,13 +764,12 @@ class FileManager extends Plugin { |
|
|
|
|
} catch (e) { |
|
|
|
|
return callback(e.message || e) |
|
|
|
|
} |
|
|
|
|
self.syncEditor(fileProvider + name) |
|
|
|
|
await self.syncEditor(fileProvider + name) |
|
|
|
|
} |
|
|
|
|
callback() |
|
|
|
|
}) |
|
|
|
|
}, (error) => { |
|
|
|
|
if (callback) callback(error) |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
}x |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
currentWorkspace () { |
|
|
|
|