pull/3094/head
Grandschtroumpf 6 years ago
parent d96ec98019
commit b1173e6d65
  1. 28
      src/app/files/fileManager.js

@ -164,20 +164,6 @@ class FileManager extends ApiFactory {
}
switchFile (file) {
if (file) return _switchFile(file)
else {
var browserProvider = this._deps.filesProviders['browser']
browserProvider.resolveDirectory('browser', (error, filesTree) => {
if (error) console.error(error)
var fileList = Object.keys(filesTree)
if (fileList.length) {
_switchFile(browserProvider.type + '/' + fileList[0])
} else {
this.events.emit('currentFileChanged')
this._deps.editor.displayEmptyReadOnlySession()
}
})
}
const _switchFile = (file) => {
this.saveCurrentFile()
this._deps.config.set('currentFile', file)
@ -195,6 +181,20 @@ class FileManager extends ApiFactory {
}
})
}
if (file) return _switchFile(file)
else {
var browserProvider = this._deps.filesProviders['browser']
browserProvider.resolveDirectory('browser', (error, filesTree) => {
if (error) console.error(error)
var fileList = Object.keys(filesTree)
if (fileList.length) {
_switchFile(browserProvider.type + '/' + fileList[0])
} else {
this.events.emit('currentFileChanged')
this._deps.editor.displayEmptyReadOnlySession()
}
})
}
}
getFilesFromPath (path) {

Loading…
Cancel
Save