This commit is contained in:
Lars T Hansen 2014-10-24 18:41:24 +02:00
commit 5e4429b796

View File

@ -1276,14 +1276,14 @@ XRE_XPCShellMain(int argc, char **argv, char **envp)
// bundle. Libraries will be loaded at a relative path to GreD, i.e. // bundle. Libraries will be loaded at a relative path to GreD, i.e.
// ../MacOS. // ../MacOS.
nsCOMPtr<nsIFile> tmpDir; nsCOMPtr<nsIFile> tmpDir;
XRE_GetFileFromPath(argv[0], getter_AddRefs(tmpDir)); XRE_GetFileFromPath(argv[0], getter_AddRefs(greDir));
tmpDir->GetParent(getter_AddRefs(greDir)); greDir->GetParent(getter_AddRefs(tmpDir));
greDir->SetNativeLeafName(NS_LITERAL_CSTRING("Resources")); tmpDir->Clone(getter_AddRefs(greDir));
tmpDir->SetNativeLeafName(NS_LITERAL_CSTRING("Resources"));
bool dirExists = false; bool dirExists = false;
greDir->Exists(&dirExists); tmpDir->Exists(&dirExists);
if (!dirExists) { if (dirExists) {
printf("Setting GreD failed.\n"); greDir = tmpDir.forget();
return 1;
} }
dirprovider.SetGREDirs(greDir); dirprovider.SetGREDirs(greDir);
#else #else
@ -1552,7 +1552,11 @@ XPCShellDirProvider::SetGREDirs(nsIFile* greDir)
mGREDir = greDir; mGREDir = greDir;
mGREDir->Clone(getter_AddRefs(mGREBinDir)); mGREDir->Clone(getter_AddRefs(mGREBinDir));
#ifdef XP_MACOSX #ifdef XP_MACOSX
mGREBinDir->SetNativeLeafName(NS_LITERAL_CSTRING("MacOS")); nsAutoCString leafName;
mGREDir->GetNativeLeafName(leafName);
if (leafName.Equals("Resources")) {
mGREBinDir->SetNativeLeafName(NS_LITERAL_CSTRING("MacOS"));
}
#endif #endif
} }