Fix unable to open a new file via CLI (#2683)

* Temporary fix for yarn complaining about upath

See this issue for details: https://github.com/anodynos/upath/issues/21

* Fix #2675: cannot open a new file

Made a minor change to browser/src/App.ts to only filter files if they
exists and pass them through otherwise.
This commit is contained in:
Sam Vervaeck 2018-12-15 22:37:19 +01:00 committed by Bryan Phelps
parent 6128e77ced
commit d66d786218
1 changed files with 7 additions and 1 deletions

View File

@ -111,7 +111,13 @@ export const start = async (args: string[]): Promise<void> => {
arg => (path.isAbsolute(arg) ? arg : path.join(currentWorkingDirectory, arg)),
)
const filesToOpen = normalizedFiles.filter(f => fs.existsSync(f) && fs.statSync(f).isFile())
const filesToOpen = normalizedFiles.filter(f => {
if (fs.existsSync(f)) {
return fs.statSync(f).isFile()
} else {
return true
}
})
const foldersToOpen = normalizedFiles.filter(
f => fs.existsSync(f) && fs.statSync(f).isDirectory(),
)