Skip to content

Commit

Permalink
fix auto select active project (#4146)
Browse files Browse the repository at this point in the history
Contributed by STMicroelectronics
Signed-off-by: Matthieu NAUD<[email protected]>
  • Loading branch information
MNASTM committed Nov 4, 2024
1 parent d0ad11e commit 0895493
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Bug Fixes:

- Fix our setting of `isUserPreset` for presets, only set it to `true` if it's defined in a user presets file. [#4059](https://github.com/microsoft/vscode-cmake-tools/issues/4059)
- Fix issue where duplicate presets are being listed in dropdown. [#4104](https://github.com/microsoft/vscode-cmake-tools/issues/4104)
- Fix auto select active project corner case. [#4146](https://github.com/microsoft/vscode-cmake-tools/issues/4146) Contributed by STMicroelectronics

## 1.19.52

Expand Down
8 changes: 7 additions & 1 deletion src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -947,7 +947,13 @@ export async function scheduleAsyncTask<T>(task: () => Promise<T>): Promise<T> {
export function isFileInsideFolder(uri: vscode.Uri, folderPath: string): boolean {
const parent = platformNormalizePath(folderPath);
const file = platformNormalizePath(uri.fsPath);
return file.startsWith(parent);

// Ensure project path ends with a path separator to avoid partial matches
const parentWithEndingSeparator = parent.endsWith(path.posix.sep)
? parent
: `${parent}${path.posix.sep}`;

return file.startsWith(parentWithEndingSeparator);
}

/**
Expand Down

0 comments on commit 0895493

Please sign in to comment.