From ded6da2abcab1761eef2adb82eddedd3932ecea1 Mon Sep 17 00:00:00 2001 From: "duncan%be.com" Date: Fri, 30 Jul 1999 12:03:25 +0000 Subject: [PATCH] Fix ResolveSymlink for BeOS (BeOS doesn't have realpath). BEOS ONLY FIX NEEDED TO UNBREAK THE BUILD! git-svn-id: svn://10.0.0.236/trunk@41591 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/xpcom/io/nsFileSpecBeOS.cpp | 35 ++++++++++++++++------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/mozilla/xpcom/io/nsFileSpecBeOS.cpp b/mozilla/xpcom/io/nsFileSpecBeOS.cpp index 29273ea09a2..ece08d54507 100644 --- a/mozilla/xpcom/io/nsFileSpecBeOS.cpp +++ b/mozilla/xpcom/io/nsFileSpecBeOS.cpp @@ -156,23 +156,26 @@ nsresult nsFileSpec::ResolveSymlink(PRBool& wasAliased) resolvedPath[charCount] = '\0'; wasAliased = PR_TRUE; - /* if it's not an absolute path, - replace the leaf with what got resolved */ - if (resolvedPath[0] != '/') { - SetLeafName(resolvedPath); - } - else { - mPath = (char*)&resolvedPath; - } + /* if it's not an absolute path, + replace the leaf with what got resolved */ + if (resolvedPath[0] != '/') { + SetLeafName(resolvedPath); + } + else { + mPath = (char*)&resolvedPath; + } - char* canonicalPath = realpath((const char *)mPath, resolvedPath); - NS_ASSERTION(canonicalPath, "realpath failed"); - if (canonicalPath) { - mPath = (char*)&resolvedPath; - } - else { - return NS_ERROR_FAILURE; - } + BEntry e((const char *)mPath, true); // traverse symlink + BPath p; + status_t err; + err = e.GetPath(&p); + NS_ASSERTION(err == B_OK, "realpath failed"); + + const char* canonicalPath = p.Path(); + if(err == B_OK) + mPath = (char*)&canonicalPath; + else + return NS_ERROR_FAILURE; } return NS_OK; } // nsFileSpec::ResolveSymlink