Skip to content

Commit e7e5e65

Browse files
committed
Fix an issue with vswhere
If Visual Studio has been removed from the system, vswhere returned no output, crashing the program
1 parent 8a63752 commit e7e5e65

2 files changed

Lines changed: 2 additions & 4 deletions

File tree

code/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ int main (int argc, char **argv) {
158158
else {
159159
auto [status, default_toolchain] = discover_toolchain(&arena);
160160
if (!status) {
161-
print(&arena, "Couldn't find any suitable C/C++ toolchain installed on the system.");
161+
print(&arena, "Couldn't find any suitable C/C++ toolchain installed on the system.\n");
162162
return EXIT_FAILURE;
163163
}
164164

code/toolchain_win32.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,10 @@ static Result<String> get_msvc_installation_path (Memory_Arena *arena) {
6262

6363
auto command = format_string(arena, R"("%\\Microsoft Visual Studio\\Installer\\vswhere.exe" -property installationPath)", program_files_path);
6464
auto [vswhere_status, vs_path] = run_system_command(arena, command);
65-
if (vswhere_status != Status_Code::Success) {
65+
if ((vswhere_status != Status_Code::Success) || !vs_path.length) {
6666
return { Status_Code::Resource_Missing, "Couldn't find Visual Studio on the system." };
6767
}
6868

69-
assert(vs_path.length > 0);
70-
7169
auto msvc_folder_query = format_string(arena, "%\\VC\\Tools\\MSVC\\*", vs_path);
7270

7371
WIN32_FIND_DATA data;

0 commit comments

Comments
 (0)