зеркало из https://github.com/mozilla/gecko-dev.git
fix for #13704.
also, instead of just checking that ".msf" or ".snm" or ".summary" appears in th e file name, we now check if the filename *ends* with ".msf", ".snm" or ".summar y".
This commit is contained in:
Родитель
abe7c5a68c
Коммит
5068559111
|
@ -47,6 +47,7 @@
|
||||||
#else
|
#else
|
||||||
#define SUMMARY_SUFFIX_IN_4x ".snm"
|
#define SUMMARY_SUFFIX_IN_4x ".snm"
|
||||||
#endif /* XP_UNIX */
|
#endif /* XP_UNIX */
|
||||||
|
#define SUMMARY_SUFFIX_IN_5x ".msf"
|
||||||
|
|
||||||
#define PREMIGRATION_PREFIX "premigration"
|
#define PREMIGRATION_PREFIX "premigration"
|
||||||
#define PREF_MAIL_DIRECTORY "mail.directory"
|
#define PREF_MAIL_DIRECTORY "mail.directory"
|
||||||
|
@ -622,7 +623,22 @@ nsPrefMigration::GetDirFromPref(const char *oldProfilePath, const char* newProfi
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static PRBool
|
||||||
|
nsStringEndsWith(nsString& name, const char *ending)
|
||||||
|
{
|
||||||
|
if (!ending) return PR_FALSE;
|
||||||
|
|
||||||
|
PRInt32 len = name.Length();
|
||||||
|
if (len == 0) return PR_FALSE;
|
||||||
|
|
||||||
|
PRInt32 endingLen = PL_strlen(ending);
|
||||||
|
if (len > endingLen && name.RFind(ending, PR_TRUE) == len - endingLen) {
|
||||||
|
return PR_TRUE;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return PR_FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
/*---------------------------------------------------------------------------------
|
/*---------------------------------------------------------------------------------
|
||||||
* GetSizes reads the 4.x files in the profile tree and accumulates their sizes
|
* GetSizes reads the 4.x files in the profile tree and accumulates their sizes
|
||||||
*
|
*
|
||||||
|
@ -646,7 +662,7 @@ nsPrefMigration::GetSizes(nsFileSpec inputPath, PRBool readSubdirs, PRUint32 *si
|
||||||
folderName = fileOrDirName.GetLeafName();
|
folderName = fileOrDirName.GetLeafName();
|
||||||
fileOrDirNameStr = folderName;
|
fileOrDirNameStr = folderName;
|
||||||
len = fileOrDirNameStr.Length();
|
len = fileOrDirNameStr.Length();
|
||||||
if (fileOrDirNameStr.Find(SUMMARY_SUFFIX_IN_4x, PR_TRUE) != -1) /* Don't copy the summary files */
|
if (nsStringEndsWith(fileOrDirNameStr, SUMMARY_SUFFIX_IN_4x) || nsStringEndsWith(fileOrDirNameStr, SUMMARY_SUFFIX_IN_5x)) /* Don't copy the summary files */
|
||||||
continue;
|
continue;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -753,7 +769,7 @@ nsPrefMigration::DoTheCopy(nsFileSpec oldPath, nsFileSpec newPath, PRBool readSu
|
||||||
folderName = fileOrDirName.GetLeafName(); //get the filename without the full path
|
folderName = fileOrDirName.GetLeafName(); //get the filename without the full path
|
||||||
fileOrDirNameStr = folderName;
|
fileOrDirNameStr = folderName;
|
||||||
|
|
||||||
if (fileOrDirNameStr.Find(SUMMARY_SUFFIX_IN_4x, PR_TRUE) != -1) /* Don't copy the summary files */
|
if (nsStringEndsWith(fileOrDirNameStr, SUMMARY_SUFFIX_IN_4x) || nsStringEndsWith(fileOrDirNameStr, SUMMARY_SUFFIX_IN_5x)) /* Don't copy the summary files */
|
||||||
continue;
|
continue;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -932,4 +948,3 @@ nsPrefMigration::OnShutdown(const nsCID& aClass, nsISupports *service)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче