fix switchFile

pull/1/head
yann300 7 years ago
parent c86dadc8e7
commit e50039d51c
  1. 10
      src/app/files/fileManager.js

@ -121,17 +121,19 @@ class FileManager {
switchFile (file) { switchFile (file) {
var self = this var self = this
if (!file) { if (file) return _switchFile(file)
self.opt.filesProviders['browser'].resolveDirectory('browser', (error, filesTree) => { else {
var browserProvider = self.opt.filesProviders['browser']
browserProvider.resolveDirectory('browser', (error, filesTree) => {
if (error) console.error(error) if (error) console.error(error)
var fileList = Object.keys(filesTree) var fileList = Object.keys(filesTree)
if (fileList.length) { if (fileList.length) {
_switchFile(fileList[0]) _switchFile(browserProvider.type + '/' + fileList[0])
} else { } else {
self.event.trigger('currentFileChanged', []) self.event.trigger('currentFileChanged', [])
} }
}) })
} else _switchFile(file) }
function _switchFile (file) { function _switchFile (file) {
self.saveCurrentFile() self.saveCurrentFile()
self.opt.config.set('currentFile', file) self.opt.config.set('currentFile', file)

Loading…
Cancel
Save