Kaynağa Gözat

Use realpath() in make_canonical to properly resolve symlinks

rdb 15 yıl önce
ebeveyn
işleme
09f6436745
1 değiştirilmiş dosya ile 8 ekleme ve 0 silme
  1. 8 0
      dtool/src/dtoolutil/filename.cxx

+ 8 - 0
dtool/src/dtoolutil/filename.cxx

@@ -1064,6 +1064,14 @@ make_canonical() {
     // The root directory is a special case.
     // The root directory is a special case.
     return true;
     return true;
   }
   }
+  
+#ifndef WIN32
+  // Use realpath in order to resolve symlinks properly
+  char newpath [PATH_MAX + 1];
+  if (realpath(c_str(), newpath) != NULL) {
+    (*this) = newpath;
+  }
+#endif
 
 
   Filename cwd = ExecutionEnvironment::get_cwd();
   Filename cwd = ExecutionEnvironment::get_cwd();
   if (!r_make_canonical(cwd)) {
   if (!r_make_canonical(cwd)) {