diff --git a/mozilla/toolkit/components/commandlines/src/nsCommandLine.cpp b/mozilla/toolkit/components/commandlines/src/nsCommandLine.cpp index c842fc31e96..c7cbb4d2ce0 100644 --- a/mozilla/toolkit/components/commandlines/src/nsCommandLine.cpp +++ b/mozilla/toolkit/components/commandlines/src/nsCommandLine.cpp @@ -64,6 +64,8 @@ #include #elif defined(XP_UNIX) #include +#elif defined(XP_OS2) +#include #endif #ifdef DEBUG_bsmedberg @@ -345,7 +347,7 @@ nsCommandLine::ResolveFile(const nsAString& aArgument, nsIFile* *aResult) NS_ADDREF(*aResult = lf); return NS_OK; -#elif defined(XP_WIN32) || defined(XP_OS2) +#elif defined(XP_WIN32) nsCOMPtr lf (do_CreateInstance(NS_LOCAL_FILE_CONTRACTID)); NS_ENSURE_TRUE(lf, NS_ERROR_OUT_OF_MEMORY); @@ -375,6 +377,32 @@ nsCommandLine::ResolveFile(const nsAString& aArgument, nsIFile* *aResult) NS_ADDREF(*aResult = lf); return NS_OK; +#elif defined(XP_OS2) + nsCOMPtr lf (do_CreateInstance(NS_LOCAL_FILE_CONTRACTID)); + NS_ENSURE_TRUE(lf, NS_ERROR_OUT_OF_MEMORY); + + rv = lf->InitWithPath(aArgument); + if (NS_FAILED(rv)) { + + nsCAutoString fullPath; + mWorkingDir->GetNativePath(fullPath); + + nsCAutoString carg; + NS_CopyUnicodeToNative(aArgument, carg); + + fullPath.Append('\\'); + fullPath.Append(carg); + + char pathBuf[CCHMAXPATH]; + if (DosQueryPathInfo(fullPath.get(), FIL_QUERYFULLNAME, pathBuf, sizeof(pathBuf))) + return NS_ERROR_FAILURE; + + rv = lf->InitWithNativePath(nsDependentCString(pathBuf)); + if (NS_FAILED(rv)) return rv; + } + NS_ADDREF(*aResult = lf); + return NS_OK; + #else #error Need platform-specific logic here. #endif diff --git a/mozilla/xpcom/io/SpecialSystemDirectory.cpp b/mozilla/xpcom/io/SpecialSystemDirectory.cpp index f4cc388859b..9c1265d5596 100644 --- a/mozilla/xpcom/io/SpecialSystemDirectory.cpp +++ b/mozilla/xpcom/io/SpecialSystemDirectory.cpp @@ -249,9 +249,12 @@ GetSpecialSystemDirectory(SystemDirectories aSystemSystemDirectory, switch (aSystemSystemDirectory) { case OS_CurrentWorkingDirectory: -#if defined(XP_WIN) || defined(XP_OS2) +#if defined(XP_WIN) if (!_getcwd(path, MAXPATHLEN)) return NS_ERROR_FAILURE; +#elif defined(XP_OS2) + if (DosQueryPathInfo( ".", FIL_QUERYFULLNAME, path, MAXPATHLEN)) + return NS_ERROR_FAILURE; #else if(!getcwd(path, MAXPATHLEN)) return NS_ERROR_FAILURE;