summaryrefslogtreecommitdiff
path: root/modules/mono/editor
diff options
context:
space:
mode:
authorIgnacio Etcheverry <ignalfonsore@gmail.com>2019-02-27 02:43:49 +0100
committerIgnacio Etcheverry <ignalfonsore@gmail.com>2019-02-27 02:43:53 +0100
commit823fb59e107332de64dddd8e5d7f2fba92e95bb0 (patch)
tree8ae1b06043002abbda87964d13c649a3a9f22a8c /modules/mono/editor
parent51c1d55cf9089cefbde034893b4784a5d554ddcc (diff)
Remove problematic VS Code hint path on Windows
Diffstat (limited to 'modules/mono/editor')
-rw-r--r--modules/mono/editor/godotsharp_editor.cpp42
1 files changed, 11 insertions, 31 deletions
diff --git a/modules/mono/editor/godotsharp_editor.cpp b/modules/mono/editor/godotsharp_editor.cpp
index 17e29fba19..c3c9175726 100644
--- a/modules/mono/editor/godotsharp_editor.cpp
+++ b/modules/mono/editor/godotsharp_editor.cpp
@@ -277,43 +277,23 @@ Error GodotSharpEditor::open_in_external_editor(const Ref<Script> &p_script, int
// TODO: Use initializer lists once C++11 is allowed
- // Try with hint paths
- static Vector<String> hint_paths;
-#ifdef WINDOWS_ENABLED
- if (hint_paths.empty()) {
- hint_paths.push_back(OS::get_singleton()->get_environment("ProgramFiles") + "\\Microsoft VS Code\\Code.exe");
- if (sizeof(size_t) == 8) {
- hint_paths.push_back(OS::get_singleton()->get_environment("ProgramFiles(x86)") + "\\Microsoft VS Code\\Code.exe");
- }
+ static Vector<String> vscode_names;
+ if (vscode_names.empty()) {
+ vscode_names.push_back("code");
+ vscode_names.push_back("code-oss");
+ vscode_names.push_back("vscode");
+ vscode_names.push_back("vscode-oss");
+ vscode_names.push_back("visual-studio-code");
+ vscode_names.push_back("visual-studio-code-oss");
}
-#endif
- for (int i = 0; i < hint_paths.size(); i++) {
- vscode_path = hint_paths[i];
- if (FileAccess::exists(vscode_path)) {
+ for (int i = 0; i < vscode_names.size(); i++) {
+ vscode_path = path_which(vscode_names[i]);
+ if (!vscode_path.empty()) {
found = true;
break;
}
}
- if (!found) {
- static Vector<String> vscode_names;
- if (vscode_names.empty()) {
- vscode_names.push_back("code");
- vscode_names.push_back("code-oss");
- vscode_names.push_back("vscode");
- vscode_names.push_back("vscode-oss");
- vscode_names.push_back("visual-studio-code");
- vscode_names.push_back("visual-studio-code-oss");
- }
- for (int i = 0; i < vscode_names.size(); i++) {
- vscode_path = path_which(vscode_names[i]);
- if (!vscode_path.empty()) {
- found = true;
- break;
- }
- }
- }
-
if (!found)
vscode_path.clear(); // Not found, clear so next time the empty() check is enough
}