File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
clwb/src/com/google/idea/blaze/clwb/run Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -112,7 +112,15 @@ private ImmutableList<String> getExtraDebugFlags(ExecutionEnvironment env) {
112112 final var flagsBuilder = ImmutableList .<String >builder ();
113113
114114 if (debuggerKind == BlazeDebuggerKind .BUNDLED_LLDB && !Registry .is ("bazel.trim.absolute.path.disabled" )) {
115- flagsBuilder .add ("--copt=-fdebug-compilation-dir=" + WorkspaceRoot .fromProject (env .getProject ()));
115+ String workspaceRootPath = WorkspaceRoot .fromProject (env .getProject ()).toString ();
116+ // Convert backslashes to forward slashes for Windows compatibility,
117+ // particularly for tools like CMake invoked via rules_foreign_cc.
118+ if (SystemInfo .isWindows ) {
119+ workspaceRootPath = workspaceRootPath .replace ('\\' , '/' );
120+ }
121+ // Keep the single quotes around the whole copt value and double quotes around the path
122+ // as Bazel might need them for correct parsing, especially if the path contains spaces.
123+ flagsBuilder .add ("--copt=-fdebug-compilation-dir='" + workspaceRootPath + "'" );
116124
117125 if (SystemInfo .isMac ) {
118126 flagsBuilder .add ("--linkopt=-Wl,-oso_prefix,." );
You can’t perform that action at this time.
0 commit comments