зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1906405 - Fix nsLocalFile::GetLast(Accessed|Modified)Time. r=xpcom-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D215835
This commit is contained in:
Родитель
d1772d4d36
Коммит
78db7aad66
|
@ -634,6 +634,9 @@ static nsresult GetFileInfo(const nsString& aName,
|
|||
aInfo->size = fileData.nFileSizeHigh;
|
||||
aInfo->size = (aInfo->size << 32) + fileData.nFileSizeLow;
|
||||
|
||||
// modifyTime must be initialized before creationTime refers it.
|
||||
FileTimeToPRTime(&fileData.ftLastWriteTime, &aInfo->modifyTime);
|
||||
|
||||
if (0 == fileData.ftCreationTime.dwLowDateTime &&
|
||||
0 == fileData.ftCreationTime.dwHighDateTime) {
|
||||
aInfo->creationTime = aInfo->modifyTime;
|
||||
|
@ -642,7 +645,6 @@ static nsresult GetFileInfo(const nsString& aName,
|
|||
}
|
||||
|
||||
FileTimeToPRTime(&fileData.ftLastAccessTime, &aInfo->accessTime);
|
||||
FileTimeToPRTime(&fileData.ftLastWriteTime, &aInfo->modifyTime);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -2389,17 +2391,11 @@ nsresult nsLocalFile::GetDateImpl(PRTime* aTime,
|
|||
FileInfo* pInfo;
|
||||
|
||||
if (aFollowLinks) {
|
||||
if (nsresult rv = GetFileInfo(mWorkingPath, &symlinkInfo); NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
pInfo = &symlinkInfo;
|
||||
} else {
|
||||
if (nsresult rv = ResolveAndStat(); NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
MOZ_TRY(ResolveAndStat());
|
||||
pInfo = &mFileInfo;
|
||||
} else {
|
||||
MOZ_TRY(GetFileInfo(mWorkingPath, &symlinkInfo));
|
||||
pInfo = &symlinkInfo;
|
||||
}
|
||||
|
||||
switch (aTimeField) {
|
||||
|
@ -2554,6 +2550,10 @@ nsresult nsLocalFile::SetDateImpl(PRTime aTime,
|
|||
|
||||
CloseHandle(file);
|
||||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
MakeDirty();
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче