Skip to content

Commit e1f30ae

Browse files
authored
Merge pull request #19 from dsnopek/windows-slash-fix
Windows: Convert forward slashes from file dilaog to backslashes
2 parents 5665188 + b40250f commit e1f30ae

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

toolkit/src/main/cpp/editor/meta_xr_simulator_dialog.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,12 @@ void MetaXRSimulatorDialog::_on_browse_button_pressed() {
118118

119119
void MetaXRSimulatorDialog::_on_file_selected(const String &p_path) {
120120
String resolved_path = ProjectSettings::get_singleton()->globalize_path(p_path);
121+
if (OS::get_singleton()->has_feature("windows")) {
122+
// Godot uses forward slashes on Windows, which is fine if we open the file in Godot,
123+
// but this value will be put in an environment variable and read by the OpenXR loader,
124+
// which won't recognize the forward slashes.
125+
resolved_path = resolved_path.replace("/", "\\");
126+
}
121127
_path_field->set_text(resolved_path);
122128
_on_path_changed(resolved_path);
123129
}

0 commit comments

Comments
 (0)