Manager: Fix UUID generation for manager config headers

Fix different UUIDs generating depending on the whether the path
is absolute or relative; they now always match the ones saved
inside .cfg files
Also reduce some code duplication
This commit is contained in:
Alexander Babikov
2025-07-28 20:25:20 +05:00
parent 494a24a3ae
commit dca59145f6
3 changed files with 13 additions and 12 deletions

View File

@@ -117,11 +117,16 @@ DlgFilter(QStringList extensions, bool last)
QString currentUuid()
{
auto configPath = QFileInfo(cfg_path).dir().canonicalPath();
if(!configPath.endsWith("/")) {
configPath.append("/");
return generateUuid(QString(cfg_path));
}
QString generateUuid(const QString &path)
{
auto dirPath = QFileInfo(path).dir().canonicalPath();
if(!dirPath.endsWith("/")) {
dirPath.append("/");
}
return QUuid::createUuidV5(QUuid{}, configPath).toString(QUuid::WithoutBraces);
return QUuid::createUuidV5(QUuid{}, dirPath).toString(QUuid::WithoutBraces);
}
bool compareUuid()