You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-12-06 17:25:19 +00:00
Fix DAP path mismatch on Windows
This commit is contained in:
@@ -341,6 +341,12 @@ Dictionary DebugAdapterParser::req_setBreakpoints(const Dictionary &p_params) co
|
|||||||
return prepare_error_response(p_params, DAP::ErrorType::WRONG_PATH, variables);
|
return prepare_error_response(p_params, DAP::ErrorType::WRONG_PATH, variables);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If path contains \, it's a Windows path, so we need to convert it to /, and make the drive letter uppercase
|
||||||
|
if (source.path.find("\\") != -1) {
|
||||||
|
source.path = source.path.replace("\\", "/");
|
||||||
|
source.path = source.path.substr(0, 1).to_upper() + source.path.substr(1);
|
||||||
|
}
|
||||||
|
|
||||||
Array breakpoints = args["breakpoints"], lines;
|
Array breakpoints = args["breakpoints"], lines;
|
||||||
for (int i = 0; i < breakpoints.size(); i++) {
|
for (int i = 0; i < breakpoints.size(); i++) {
|
||||||
DAP::SourceBreakpoint breakpoint;
|
DAP::SourceBreakpoint breakpoint;
|
||||||
|
|||||||
@@ -45,6 +45,12 @@ private:
|
|||||||
friend DebugAdapterProtocol;
|
friend DebugAdapterProtocol;
|
||||||
|
|
||||||
_FORCE_INLINE_ bool is_valid_path(const String &p_path) const {
|
_FORCE_INLINE_ bool is_valid_path(const String &p_path) const {
|
||||||
|
// If path contains \, it's a Windows path, so we need to convert it to /, and check as case-insensitive.
|
||||||
|
if (p_path.contains("\\")) {
|
||||||
|
String project_path = ProjectSettings::get_singleton()->get_resource_path();
|
||||||
|
String path = p_path.replace("\\", "/");
|
||||||
|
return path.findn(project_path) != -1;
|
||||||
|
}
|
||||||
return p_path.begins_with(ProjectSettings::get_singleton()->get_resource_path());
|
return p_path.begins_with(ProjectSettings::get_singleton()->get_resource_path());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user