Skip to content

Commit

Permalink
Fix absolute build directories
Browse files Browse the repository at this point in the history
  • Loading branch information
tristan957 committed Nov 23, 2023
1 parent d7594cc commit a6d44ce
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## next

- Bump Swift-MesonLSP to v3.1.3
- Fix absolute build directories

## 1.18.1

Expand Down
4 changes: 2 additions & 2 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
clearCache,
checkMesonIsConfigured,
getOutputChannel,
relativeBuildDir,
getBuildDirectory,
rootMesonFiles,
} from "./utils";
import { DebugConfigurationProviderCppdbg } from "./debug/cppdbg";
Expand Down Expand Up @@ -57,7 +57,7 @@ export async function activate(ctx: vscode.ExtensionContext) {

const mesonFile = savedMesonFile ?? mesonFiles[0].fsPath;
const sourceDir = dirname(mesonFile);
const buildDir = relativeBuildDir(mesonFile);
const buildDir = getBuildDirectory(sourceDir);

workspaceState.update("mesonbuild.mesonFile", mesonFile);
workspaceState.update("mesonbuild.buildDir", buildDir);
Expand Down
6 changes: 4 additions & 2 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,11 @@ export function extensionRelative(filepath: string) {
return path.join(extensionPath, filepath);
}

export function relativeBuildDir(mesonFile: string) {
export function getBuildDirectory(sourceDir: string) {
const buildDir = extensionConfiguration("buildFolder");
return path.join(path.dirname(mesonFile), buildDir);
if (path.isAbsolute(buildDir)) return buildDir;

return path.join(sourceDir, buildDir);
}

let _layoutPromise: Promise<string> | null = null;
Expand Down

0 comments on commit a6d44ce

Please sign in to comment.