mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-12-01 10:35:38 +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};
|
int systemProcessedCount {0};
|
||||||
|
|
||||||
if (cleanupFiles.size() > 0) {
|
if (cleanupFiles.size() > 0) {
|
||||||
|
struct tm tm;
|
||||||
std::string dateString(20, '\0');
|
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'));
|
dateString.erase(dateString.find('\0'));
|
||||||
const std::string targetDirectory {mMediaDirectory + "CLEANUP/" + dateString + "/"};
|
const std::string targetDirectory {mMediaDirectory + "CLEANUP/" + dateString + "/"};
|
||||||
|
|
||||||
|
@ -549,8 +555,14 @@ void GuiOrphanedDataCleanup::cleanupGamelists()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (removeCount > 0) {
|
if (removeCount > 0) {
|
||||||
|
struct tm tm;
|
||||||
std::string dateString(20, '\0');
|
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'));
|
dateString.erase(dateString.find('\0'));
|
||||||
const std::string targetDirectory {
|
const std::string targetDirectory {
|
||||||
Utils::FileSystem::getParent(
|
Utils::FileSystem::getParent(
|
||||||
|
@ -733,8 +745,14 @@ void GuiOrphanedDataCleanup::cleanupCollections()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (removeCount > 0) {
|
if (removeCount > 0) {
|
||||||
|
struct tm tm;
|
||||||
std::string dateString(20, '\0');
|
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'));
|
dateString.erase(dateString.find('\0'));
|
||||||
const std::string targetDirectory {Utils::FileSystem::getParent(collectionFile) +
|
const std::string targetDirectory {Utils::FileSystem::getParent(collectionFile) +
|
||||||
"/CLEANUP/" + dateString + "/"};
|
"/CLEANUP/" + dateString + "/"};
|
||||||
|
|
Loading…
Reference in a new issue