Skip to content

Commit 18f9cec

Browse files
committed
Fix relative paths (again)
This are hard to get right, and harder to test.
1 parent acfc93a commit 18f9cec

File tree

5 files changed

+8
-6
lines changed

5 files changed

+8
-6
lines changed

src/features/Examples.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export class ExamplesFeature implements vscode.Disposable {
99
private examplesPath: string;
1010

1111
constructor() {
12-
this.examplesPath = path.resolve(__dirname, "../../examples");
12+
this.examplesPath = path.resolve(__dirname, "../examples");
1313
this.command = vscode.commands.registerCommand("PowerShell.OpenExamplesFolder", () => {
1414
vscode.commands.executeCommand(
1515
"vscode.openFolder",

src/features/PesterTests.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export class PesterTestsFeature implements vscode.Disposable {
1818
private invokePesterStubScriptPath: string;
1919

2020
constructor(private sessionManager: SessionManager) {
21-
this.invokePesterStubScriptPath = path.resolve(__dirname, "../../modules/PowerShellEditorServices/InvokePesterStub.ps1");
21+
this.invokePesterStubScriptPath = path.resolve(__dirname, "../modules/PowerShellEditorServices/InvokePesterStub.ps1");
2222

2323
// File context-menu command - Run Pester Tests
2424
this.command = vscode.commands.registerCommand(

src/settings.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,8 @@ export function load(): ISettings {
157157

158158
const defaultDeveloperSettings: IDeveloperSettings = {
159159
featureFlags: [],
160+
// From `<root>/out/main.js` we go to the directory before <root> and
161+
// then into the other repo.
160162
bundledModulesPath: "../../PowerShellEditorServices/module",
161163
editorServicesLogLevel: "Normal",
162164
editorServicesWaitForDebugger: false,
@@ -234,7 +236,7 @@ export function load(): ISettings {
234236
promptToUpdatePackageManagement:
235237
configuration.get<boolean>("promptToUpdatePackageManagement", true),
236238
bundledModulesPath:
237-
"../modules",
239+
"../modules", // Because the extension is always at `<root>/out/main.js`
238240
useX86Host:
239241
configuration.get<boolean>("useX86Host", false),
240242
enableProfileLoading:

src/utils.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export interface IEditorServicesSessionDetails {
4545

4646
export type IReadSessionFileCallback = (details: IEditorServicesSessionDetails) => void;
4747

48-
const sessionsFolder = path.resolve(__dirname, "..", "..", "sessions/");
48+
const sessionsFolder = path.resolve(__dirname, "../sessions");
4949
const sessionFilePathPrefix = path.resolve(sessionsFolder, "PSES-VSCode-" + process.env.VSCODE_PID);
5050

5151
// Create the sessions path if it doesn't exist already

test/features/CustomViews.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,15 @@ hello
7070
content: "console.log('asdf');",
7171
},
7272
{
73-
fileName: "../../testCustomViews.js",
73+
fileName: "../testCustomViews.js",
7474
content: "console.log('asdf');",
7575
},
7676
],
7777
cssFiles: [],
7878
expectedHtmlString: `<html><head></head><body>
7979
hello
8080
<script src="${convertToVSCodeResourceScheme(path.join(__dirname, "testCustomViews.js"))}"></script>
81-
<script src="${convertToVSCodeResourceScheme(path.join(__dirname, "../../testCustomViews.js"))}"></script>
81+
<script src="${convertToVSCodeResourceScheme(path.join(__dirname, "../testCustomViews.js"))}"></script>
8282
</body></html>`,
8383
},
8484

0 commit comments

Comments
 (0)