Bug 766269 - Thunderbird Permanent orange: TEST_UNEXPECTED_FAIL | test_0030_general.js. Correctly handle MOZ_APP_BASENAME and MOZ_APP_VENDOR being unset when determining the update location for unit tests on Windows. r=ehsan, test-only

This commit is contained in:
Mark Banner 2012-06-29 07:24:33 +01:00
parent 971e412f9e
commit 3f0160f5ad
2 changed files with 26 additions and 13 deletions

View File

@ -21,13 +21,17 @@ CMMSRCS += xpcshellMacUtils.mm
endif
ifeq (windows,$(MOZ_WIDGET_TOOLKIT))
ifdef MOZ_APP_PROFILE
DEFINES += -DMOZ_APP_PROFILE='"$(MOZ_APP_PROFILE)"'
else
DEFINES += -DMOZ_APP_VENDOR='"$(MOZ_APP_VENDOR)"'
DEFINES += -DMOZ_APP_BASENAME='"$(MOZ_APP_BASENAME)"'
DEFINES += -DMOZ_APP_NAME='"$(MOZ_APP_NAME)"'
endif
ifdef MOZ_APP_PROFILE
DEFINES += -DMOZ_APP_PROFILE='"$(MOZ_APP_PROFILE)"'
else
ifdef MOZ_APP_VENDOR
DEFINES += -DMOZ_APP_VENDOR='"$(MOZ_APP_VENDOR)"'
endif
ifdef MOZ_APP_BASENAME
DEFINES += -DMOZ_APP_BASENAME='"$(MOZ_APP_BASENAME)"'
endif
DEFINES += -DMOZ_APP_NAME='"$(MOZ_APP_NAME)"'
endif
endif
LIBS = \

View File

@ -2032,18 +2032,27 @@ XPCShellDirProvider::GetFile(const char *prop, bool *persistent,
FAILED(SHGetPathFromIDListA(pItemIDList, appData))) {
return NS_ERROR_FAILURE;
}
#ifdef MOZ_APP_PROFILE
sprintf(path, "%s\\%s", appData, MOZ_APP_PROFILE);
#else
sprintf(path, "%s\\%s\\%s\\%s", appData, MOZ_APP_VENDOR, MOZ_APP_BASENAME, MOZ_APP_NAME);
#endif
nsAutoString pathName;
pathName.AssignASCII(path);
pathName.AssignASCII(appData);
nsCOMPtr<nsIFile> localFile;
nsresult rv = NS_NewLocalFile(pathName, true, getter_AddRefs(localFile));
if (NS_FAILED(rv)) {
return rv;
}
#ifdef MOZ_APP_PROFILE
localFile->AppendNative(NS_LITERAL_CSTRING(MOZ_APP_PROFILE));
#else
// MOZ_APP_VENDOR and MOZ_APP_BASENAME are optional.
#ifdef MOZ_APP_VENDOR
localFile->AppendNative(NS_LITERAL_CSTRING(MOZ_APP_VENDOR));
#endif
#ifdef MOZ_APP_BASENAME
localFile->AppendNative(NS_LITERAL_CSTRING(MOZ_APP_BASENAME));
#endif
// However app name is always appended.
localFile->AppendNative(NS_LITERAL_CSTRING(MOZ_APP_NAME));
#endif
return localFile->Clone(result);
#else
// Fail on non-Windows platforms, the caller is supposed to fal back on