Skip to content

Commit

Permalink
Update process path after installing aftman
Browse files Browse the repository at this point in the history
  • Loading branch information
evaera committed May 24, 2022
1 parent 53fce39 commit c794a76
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/commands/serveRecent.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as path from "path"
import * as vscode from "vscode"
import { State } from "../extension"
import { getRojoInstall } from "../getRojoInstall"
import { serveProject } from "../serveProject"

export const serveRecentCommand = (state: State) =>
Expand All @@ -18,11 +19,17 @@ export const serveRecentCommand = (state: State) =>
const workspaceFolder = vscode.workspace.getWorkspaceFolder(uri)

if (workspaceFolder) {
return serveProject(state, {
const projectFile = {
name: path.basename(lastFilePath),
workspaceFolderName: workspaceFolder.name,
path: uri,
})
}

const install = await getRojoInstall(projectFile)

if (install) {
return serveProject(state, projectFile)
}
}
} catch (e) {
// fall through
Expand Down
6 changes: 6 additions & 0 deletions src/installRojo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,12 @@ export async function installRojo(folder: string) {
}
}

if ("PATH" in process.env) {
const envPath = process.env.PATH!.split(path.delimiter)
envPath.push(path.join(os.homedir(), ".aftman", "bin"))
process.env.PATH = envPath.join(path.delimiter)
}

await exec("aftman trust rojo-rbx/rojo", {
cwd: folder,
})
Expand Down

0 comments on commit c794a76

Please sign in to comment.