Skip to content

Commit c917029

Browse files
authored
Fix issues on Windows (#229)
1 parent ea14f61 commit c917029

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/bazel/bazel_query.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ export class BazelQuery extends BazelCommand {
9797
const result = buffer
9898
.toString("utf-8")
9999
.trim()
100+
.replace(/\r\n|\r/g, "\n")
100101
.split("\n")
101102
.sort();
102103
return result;

src/bazel/bazel_utils.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ export async function getTargetsForBuildFile(
4040
if (relDirWithDoc === ".") {
4141
relDirWithDoc = "";
4242
}
43+
// Change \ (backslash) to / (forward slash) when on Windows
44+
relDirWithDoc = relDirWithDoc.replace(/\\/g, "/");
4345
// Turn the relative path into a package label
4446
const pkg = `//${relDirWithDoc}`;
4547
const queryResult = await new BazelQuery(
@@ -71,7 +73,8 @@ function shouldIgnorePath(fsPath: string): boolean {
7173
}
7274
} catch (err) {
7375
vscode.window.showErrorMessage(
74-
"pathsToIgnore value isn't a valid regex: " + escape(pathRegex));
76+
"pathsToIgnore value isn't a valid regex: " + escape(pathRegex),
77+
);
7578
}
7679
}
7780
return false;

0 commit comments

Comments
 (0)