[Support] Resolve symlinks in getMainExecutable() on Windows (#76304)
This makes the Windows implementation for `getMainExecutable()` behave the same as its Linux counterpart, in regards to symlinks. Previously, when using `cmake ... -DLLVM_USE_SYMLINKS=ON`, calling this function wouldn't resolve to the "real", non-symlinked path.
This commit is contained in:
@@ -154,7 +154,10 @@ std::string getMainExecutable(const char *argv0, void *MainExecAddr) {
|
||||
return "";
|
||||
|
||||
llvm::sys::path::make_preferred(PathNameUTF8);
|
||||
return std::string(PathNameUTF8.data());
|
||||
|
||||
SmallString<256> RealPath;
|
||||
sys::fs::real_path(PathNameUTF8, RealPath);
|
||||
return std::string(RealPath);
|
||||
}
|
||||
|
||||
UniqueID file_status::getUniqueID() const {
|
||||
|
||||
Reference in New Issue
Block a user