Bug 550659 - Resolve the xulrunner path when it is a symbolic link in the xulrunner stub. r=bsmedberg
authorMike Hommey <mh+mozilla@glandium.org>
Thu, 28 Jul 2011 09:03:49 +0200
changeset 73462 b774154497e1836160006eecbc837409cb2b43db
parent 73461 f8cc3b22850294f2ab3f170defd8013524a65198
child 73463 366a1e04921c7be323023463ec4763bc1b2e3b22
push id20871
push usereakhgari@mozilla.com
push dateThu, 28 Jul 2011 14:37:48 +0000
treeherdermozilla-central@fe48bbfeff94 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbsmedberg
bugs550659
milestone8.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 550659 - Resolve the xulrunner path when it is a symbolic link in the xulrunner stub. r=bsmedberg
xulrunner/stub/nsXULStub.cpp
--- a/xulrunner/stub/nsXULStub.cpp
+++ b/xulrunner/stub/nsXULStub.cpp
@@ -309,16 +309,25 @@ main(int argc, char **argv)
   // On Linux/Win, look for XULRunner in appdir/xulrunner
 
   snprintf(greDir, sizeof(greDir),
            "%sxulrunner" XPCOM_FILE_PATH_SEPARATOR XPCOM_DLL,
            iniPath);
 
   greFound = FolderExists(greDir);
 
+#ifdef XP_UNIX
+  if (greFound) {
+    char resolved_greDir[MAXPATHLEN] = "";
+    if (realpath(greDir, resolved_greDir) && *resolved_greDir) {
+      strncpy(greDir, resolved_greDir, MAXPATHLEN);
+    }
+  }
+#endif
+
   strncpy(lastSlash, "application.ini", sizeof(iniPath) - (lastSlash - iniPath));
 
 #endif
 
   // If -app parameter was passed in, it is now time to take it under 
   // consideration.
   const char *appDataFile;
   appDataFile = getenv("XUL_APP_FILE");