mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-02-18 04:45:39 +00:00
Fixed an issue where multiple levels of symlinking in the ROMs directory tree could crash the application on startup.
This commit is contained in:
parent
8cc3d1aac5
commit
b055493894
|
@ -347,20 +347,23 @@ bool SystemData::populateFolder(FileData* folder)
|
||||||
// Make sure that it's not a recursive symlink pointing to a location higher in the
|
// Make sure that it's not a recursive symlink pointing to a location higher in the
|
||||||
// hierarchy as the application would run forever trying to resolve the link.
|
// hierarchy as the application would run forever trying to resolve the link.
|
||||||
if (Utils::FileSystem::isSymlink(filePath)) {
|
if (Utils::FileSystem::isSymlink(filePath)) {
|
||||||
const std::string canonicalPath = Utils::FileSystem::getCanonicalPath(filePath);
|
const std::string canonicalPath {Utils::FileSystem::getCanonicalPath(filePath)};
|
||||||
const std::string canonicalStartPath =
|
const std::string canonicalStartPath {
|
||||||
Utils::FileSystem::getCanonicalPath(mEnvData->mStartPath);
|
Utils::FileSystem::getCanonicalPath(mEnvData->mStartPath)};
|
||||||
const std::string combinedPath =
|
if (canonicalPath.size() >= canonicalStartPath.size()) {
|
||||||
mEnvData->mStartPath +
|
const std::string combinedPath {
|
||||||
canonicalPath.substr(canonicalStartPath.size(),
|
mEnvData->mStartPath +
|
||||||
canonicalStartPath.size() - canonicalPath.size());
|
canonicalPath.substr(canonicalStartPath.size(),
|
||||||
if (filePath.find(combinedPath) == 0) {
|
canonicalStartPath.size() - canonicalPath.size())};
|
||||||
LOG(LogWarning) << "Skipped \"" << filePath << "\" as it's a recursive symlink";
|
if (filePath.find(combinedPath) == 0) {
|
||||||
continue;
|
LOG(LogWarning)
|
||||||
|
<< "Skipped \"" << filePath << "\" as it's a recursive symlink";
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FileData* newFolder = new FileData(FOLDER, filePath, mEnvData, this);
|
FileData* newFolder {new FileData(FOLDER, filePath, mEnvData, this)};
|
||||||
populateFolder(newFolder);
|
populateFolder(newFolder);
|
||||||
|
|
||||||
if (mFlattenFolders) {
|
if (mFlattenFolders) {
|
||||||
|
|
Loading…
Reference in a new issue