Skip to content

Commit

Permalink
Fix openFolder platform function on macOS
Browse files Browse the repository at this point in the history
This replaces the earlier way with the correct Objective-C way to do it.
  • Loading branch information
bluebandit21 committed Jan 12, 2021
1 parent c711d08 commit e0388a7
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/Core/Platform/PlatformMac.mm
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,10 @@ bool openFolder(const ghc::filesystem::path& path){
Locator::getLogger()->warn("Could not open folder. Note a folder. Path: \"{}\"", path.string());
return false;
}
int res = system(fmt::format("open {}", path.string()).c_str());
if(res != 0){
Locator::getLogger()->warn("Unable to open folder. \"open\" command return code: {}. URL: {}", res, path.string());
NSURL* directory = [NSURL fileURLWithPath:@(path.c_str())];
bool succeeded = [[NSWorkspace sharedWorkspace]openURL:directory];
if(!succeeded){
Locator::getLogger()->warn("Unable to open folder: {}", path.string());
return false;
}
return true;
Expand Down Expand Up @@ -136,4 +137,4 @@ bool unboostPriority()
Locator::getLogger()->warn("Core::Platform::unboostPriority not implemented");
return true;
}
}
}

0 comments on commit e0388a7

Please sign in to comment.