mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-22 06:05:38 +00:00
Fixed an issue where adding trailing directory separators to the MediaDirectory setting could make the Orphaned data cleanup utility remove too many files
This commit is contained in:
parent
724ba0cfea
commit
5bad361121
|
@ -22,7 +22,6 @@ GuiOrphanedDataCleanup::GuiOrphanedDataCleanup(std::function<void()> reloadCallb
|
|||
, mGrid {glm::ivec2 {4, 11}}
|
||||
, mReloadCallback {reloadCallback}
|
||||
, mCursorPos {0}
|
||||
, mMediaDirectory {FileData::getMediaDirectory()}
|
||||
, mMediaTypes {"3dboxes", "backcovers", "covers", "fanart",
|
||||
"manuals", "marquees", "miximages", "physicalmedia",
|
||||
"screenshots", "titlescreens", "videos"}
|
||||
|
@ -36,6 +35,23 @@ GuiOrphanedDataCleanup::GuiOrphanedDataCleanup(std::function<void()> reloadCallb
|
|||
, mCaseSensitiveFilesystem {true}
|
||||
, mCleanupType {CleanupType::MEDIA}
|
||||
{
|
||||
// Make sure we always have a single trailing directory separator for the media directory.
|
||||
mMediaDirectory = FileData::getMediaDirectory();
|
||||
mMediaDirectory.erase(std::find_if(mMediaDirectory.rbegin(), mMediaDirectory.rend(),
|
||||
[](char c) { return c != '/'; })
|
||||
.base(),
|
||||
mMediaDirectory.end());
|
||||
|
||||
mMediaDirectory.erase(std::find_if(mMediaDirectory.rbegin(), mMediaDirectory.rend(),
|
||||
[](char c) { return c != '\\'; })
|
||||
.base(),
|
||||
mMediaDirectory.end());
|
||||
#if defined(_WIN64)
|
||||
mMediaDirectory.append("\\");
|
||||
#else
|
||||
mMediaDirectory.append("/");
|
||||
#endif
|
||||
|
||||
addChild(&mBackground);
|
||||
addChild(&mGrid);
|
||||
|
||||
|
|
Loading…
Reference in a new issue