I am using this code to get absolute path of a file:
String getAbsolutePath(String x){
char path[FILENAME_MAX+1];
realpath(x.c_str(),path);
return toString(path);
}
But the realpath()
function resolves symlinks too. How can I not resolve the symlinks i.e get the path of the symlink itself (not the file pointed to by the link)?