Change navigateToProjectRoot to accept folders. (#1866)

* Check if the supplied path is a directory, and load that instead if it is.

* Tidy up.
This commit is contained in:
Ryan C 2018-03-21 23:01:19 +00:00 committed by GitHub
parent b95d22725e
commit 3e397df022
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -130,7 +130,12 @@ export class Workspace implements IWorkspace {
public navigateToProjectRoot = async (bufferPath: string) => {
const projectMarkers = this._configuration.getValue("workspace.autoDetectRootFiles")
const cwd = path.dirname(bufferPath)
// If the supplied path is a folder, we should use that instead of
// moving up a folder again.
// Helps when calling Oni from the CLI with "oni ."
const cwd = (await this.pathIsDir(bufferPath)) ? bufferPath : path.dirname(bufferPath)
const filePath = await findup(projectMarkers, { cwd })
if (filePath) {
const dir = path.dirname(filePath)