Remove problematic VS Code hint path on Windows

This commit is contained in:
Ignacio Etcheverry 2019-02-27 02:43:49 +01:00
parent 51c1d55cf9
commit 823fb59e10

View file

@ -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 // TODO: Use initializer lists once C++11 is allowed
// Try with hint paths static Vector<String> vscode_names;
static Vector<String> hint_paths; if (vscode_names.empty()) {
#ifdef WINDOWS_ENABLED vscode_names.push_back("code");
if (hint_paths.empty()) { vscode_names.push_back("code-oss");
hint_paths.push_back(OS::get_singleton()->get_environment("ProgramFiles") + "\\Microsoft VS Code\\Code.exe"); vscode_names.push_back("vscode");
if (sizeof(size_t) == 8) { vscode_names.push_back("vscode-oss");
hint_paths.push_back(OS::get_singleton()->get_environment("ProgramFiles(x86)") + "\\Microsoft VS Code\\Code.exe"); vscode_names.push_back("visual-studio-code");
} vscode_names.push_back("visual-studio-code-oss");
} }
#endif for (int i = 0; i < vscode_names.size(); i++) {
for (int i = 0; i < hint_paths.size(); i++) { vscode_path = path_which(vscode_names[i]);
vscode_path = hint_paths[i]; if (!vscode_path.empty()) {
if (FileAccess::exists(vscode_path)) {
found = true; found = true;
break; 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) if (!found)
vscode_path.clear(); // Not found, clear so next time the empty() check is enough vscode_path.clear(); // Not found, clear so next time the empty() check is enough
} }