mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-29 09:35:39 +00:00
Changed GuiOrphanedDataCleanup to using a safer localtime function
This commit is contained in:
parent
262c33a8af
commit
9e46d46dd5
|
@ -327,8 +327,14 @@ void GuiOrphanedDataCleanup::cleanupMediaFiles()
|
|||
int systemProcessedCount {0};
|
||||
|
||||
if (cleanupFiles.size() > 0) {
|
||||
struct tm tm;
|
||||
std::string dateString(20, '\0');
|
||||
std::strftime(&dateString[0], 20, "%Y-%m-%d_%H%M%S", localtime(¤tTime));
|
||||
#if defined(_WIN64)
|
||||
localtime_s(&tm, ¤tTime);
|
||||
std::strftime(&dateString[0], 20, "%Y-%m-%d_%H%M%S", &tm);
|
||||
#else
|
||||
std::strftime(&dateString[0], 20, "%Y-%m-%d_%H%M%S", localtime_r(¤tTime, &tm));
|
||||
#endif
|
||||
dateString.erase(dateString.find('\0'));
|
||||
const std::string targetDirectory {mMediaDirectory + "CLEANUP/" + dateString + "/"};
|
||||
|
||||
|
@ -549,8 +555,14 @@ void GuiOrphanedDataCleanup::cleanupGamelists()
|
|||
}
|
||||
|
||||
if (removeCount > 0) {
|
||||
struct tm tm;
|
||||
std::string dateString(20, '\0');
|
||||
std::strftime(&dateString[0], 20, "%Y-%m-%d_%H%M%S", localtime(¤tTime));
|
||||
#if defined(_WIN64)
|
||||
localtime_s(&tm, ¤tTime);
|
||||
std::strftime(&dateString[0], 20, "%Y-%m-%d_%H%M%S", &tm);
|
||||
#else
|
||||
std::strftime(&dateString[0], 20, "%Y-%m-%d_%H%M%S", localtime_r(¤tTime, &tm));
|
||||
#endif
|
||||
dateString.erase(dateString.find('\0'));
|
||||
const std::string targetDirectory {
|
||||
Utils::FileSystem::getParent(
|
||||
|
@ -733,8 +745,14 @@ void GuiOrphanedDataCleanup::cleanupCollections()
|
|||
}
|
||||
|
||||
if (removeCount > 0) {
|
||||
struct tm tm;
|
||||
std::string dateString(20, '\0');
|
||||
std::strftime(&dateString[0], 20, "%Y-%m-%d_%H%M%S", localtime(¤tTime));
|
||||
#if defined(_WIN64)
|
||||
localtime_s(&tm, ¤tTime);
|
||||
std::strftime(&dateString[0], 20, "%Y-%m-%d_%H%M%S", &tm);
|
||||
#else
|
||||
std::strftime(&dateString[0], 20, "%Y-%m-%d_%H%M%S", localtime_r(¤tTime, &tm));
|
||||
#endif
|
||||
dateString.erase(dateString.find('\0'));
|
||||
const std::string targetDirectory {Utils::FileSystem::getParent(collectionFile) +
|
||||
"/CLEANUP/" + dateString + "/"};
|
||||
|
|
Loading…
Reference in a new issue