Description

Only files in UFS or NonUFS manifest that are local are returning a non-minvalue timestamp.  While this is expected it is causing issues with logging file handling.

See: https://udn.unrealengine.com/questions/578380/gettimestamp-fails-for-log-files-on-android.html

Proposed fix (needs more investigating):

FDateTime GetTimeStamp(const TCHAR* Filename, bool AllowLocal)
{
#if LOG_ANDROID_FILE_MANIFEST
FPlatformMisc::LowLevelOutputDebugStringf(TEXT("FAndroidPlatformFile::GetTimeStamp('%s')"), Filename);
#endif
FString LocalPath;
FString AssetPath;
PathToAndroidPaths(LocalPath, AssetPath, Filename, AllowLocal);

if (IsLocal(LocalPath))
{

#if !USE_UTIME
FDateTime Result;
if ( NonUFSManifest.GetFileTimeStamp(AssetPath,Result) )
{
return Result;
}

if ( UFSManifest.GetFileTimeStamp( AssetPath, Result ) )
{
return Result;
}

#if LOG_ANDROID_FILE_MANIFEST
FPlatformMisc::LowLevelOutputDebugStringf(TEXT("Failed to find time stamp in NonUFSManifest for file '%s'"), Filename);
#endif

// pak file outside of obb may not be in manifest so check if it exists
if (AssetPath.EndsWith(".pak"))
{
// return local file access timestamp (if exists)
return GetAccessTimeStamp(Filename, true);
}
#endif
struct stat FileInfo;
if (stat(TCHAR_TO_UTF8(*LocalPath), &FileInfo) == -1)
{
return FDateTime::MinValue();
}
// convert _stat time to FDateTime
FTimespan TimeSinceEpoch(0, 0, FileInfo.st_mtime);
return AndroidEpoch + TimeSinceEpoch;
}
else if (IsResource(AssetPath))
{
FTimespan TimeSinceEpoch(0, 0, ZipResource.GetEntryModTime(AssetPath));
return AndroidEpoch + TimeSinceEpoch;
}
else
{
// No TimeStamp for assets, so just return a default timespan for now.
return FDateTime::MinValue();
}
}

Steps to Reproduce

Call GetTimeStamp with any local files that are not in manifest or end with .pak

Have Comments or More Details?

There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-93685 in the post.

1
Login to Vote

Unresolved
ComponentUE - Platform - Mobile
Affects Versions4.25
Target Fix5.6
CreatedMay 29, 2020
UpdatedOct 15, 2024
View Jira Issue