Only call on interactive uses

Signed-off-by: Yihe Li <winmikedows@hotmail.com>
This commit is contained in:
Yihe Li
2025-03-27 06:53:57 +08:00
parent ea44c2465c
commit 8fea37b8b7
4 changed files with 22 additions and 7 deletions

View File

@ -388,6 +388,17 @@ void BaseInstance::setName(QString val)
emit propertiesChanged(this);
}
bool BaseInstance::syncInstanceDirName() const
{
auto oldRoot = instanceRoot();
auto newRoot = FS::PathCombine(QFileInfo(oldRoot).dir().absolutePath(), name());
if (oldRoot == newRoot)
return true;
if (!QFile::rename(oldRoot, newRoot))
return false;
return true;
}
QString BaseInstance::name() const
{
return m_settings->get("name").toString();