mirror of https://github.com/exaloop/codon.git
Fix getAbsolutePath (use POSIX realpath)
parent
56cd0711f7
commit
4bfab60ac6
|
@ -247,9 +247,12 @@ ImportFile getRoot(const std::string argv0, const std::vector<std::string> &plug
|
|||
} // namespace
|
||||
|
||||
std::string getAbsolutePath(const std::string &path) {
|
||||
llvm::SmallString<128> p(path);
|
||||
llvm::sys::fs::make_absolute(p);
|
||||
return std::string(p);
|
||||
char *c = realpath(path.c_str(), nullptr);
|
||||
if (!c)
|
||||
return path;
|
||||
std::string result(c);
|
||||
free(c);
|
||||
return result;
|
||||
}
|
||||
|
||||
std::shared_ptr<ImportFile> getImportFile(const std::string &argv0,
|
||||
|
|
|
@ -167,7 +167,7 @@ template <typename T> std::vector<T> clone_nop(const std::vector<T> &t) {
|
|||
|
||||
/// Path utilities
|
||||
|
||||
/// @return The absolute path of a given path.
|
||||
/// @return The absolute canonical path of a given path.
|
||||
std::string getAbsolutePath(const std::string &path);
|
||||
|
||||
/// Detect a absolute path of the current executable (whose argv0 is known).
|
||||
|
|
Loading…
Reference in New Issue