Skip to content

Commit d59e143

Browse files
nehebpiponazo
authored andcommitted
replace readlink with std::filesystem
Simpler. Signed-off-by: Rosen Penev <[email protected]>
1 parent 6438305 commit d59e143

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

src/futils.cpp

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -375,13 +375,7 @@ std::string getProcessPath() {
375375
ret = path;
376376
}
377377
#elif defined(__unix__)
378-
// http://stackoverflow.com/questions/606041/how-do-i-get-the-path-of-a-process-in-unix-linux
379-
char path[500];
380-
ssize_t l = readlink("/proc/self/exe", path, sizeof(path) - 1);
381-
if (l > 0) {
382-
path[l] = 0;
383-
ret = path;
384-
}
378+
ret = std::filesystem::read_symlink("/proc/self/exe");
385379
#endif
386380

387381
const size_t idxLastSeparator = ret.find_last_of(EXV_SEPARATOR_STR);

0 commit comments

Comments
 (0)