     input.onchange = (=>
       if input.files.length > 0
         @latex.mainFile = input.files[0].path
+        @writeLocalCfg input.files[0].path
       @latex.panel.view.update()
     )
     input.click()

    for ext in extnames
      if path.basename(fpath).endsWith(ext)
        return [path.basename(fpath).replace(ext,''), ext.slice(1)]
        
  findMain: (here) ->
    result = @findMainSequence(here)
    if result and !fs.existsSync(@latex.mainFile)

    findFiles = () =>
        @latex.texFiles = [ @latex.mainFile ]
        @latex.bibFiles = []
        @findDependentFiles(@latex.mainFile)
    if @disable_watcher or @watchRoot()
      findFiles()
      if @disable_watcher
