mirror of
https://github.com/clangen/musikcube.git
synced 2024-11-19 20:13:36 +00:00
Fix: let libc set length of resolved in realpath
This commit is contained in:
parent
ac1e2b4096
commit
3fb2c0658a
@ -221,6 +221,12 @@ static inline std::string canonicalizePath(const std::string& path) {
|
||||
delete[] dest;
|
||||
}
|
||||
return result8;
|
||||
#elif __gnu_linux__
|
||||
char* realname = realpath(path.c_str(), NULL);
|
||||
if (!realname) {
|
||||
return "";
|
||||
}
|
||||
return std::string(realname);
|
||||
#else
|
||||
char realname[_POSIX_PATH_MAX];
|
||||
if (realpath(path.c_str(), realname) == 0) {
|
||||
@ -228,4 +234,4 @@ static inline std::string canonicalizePath(const std::string& path) {
|
||||
}
|
||||
return std::string(realname);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user