mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 04:57:58 +02:00
Fix asset server data migration
This commit is contained in:
parent
37cfac404e
commit
4ce20242b1
1 changed files with 10 additions and 3 deletions
|
@ -50,17 +50,24 @@ void AssetServer::run() {
|
||||||
auto nodeList = DependencyManager::get<NodeList>();
|
auto nodeList = DependencyManager::get<NodeList>();
|
||||||
nodeList->addNodeTypeToInterestSet(NodeType::Agent);
|
nodeList->addNodeTypeToInterestSet(NodeType::Agent);
|
||||||
|
|
||||||
const QString OLD_RESOURCES_PATH = "resources/assets";
|
|
||||||
const QString RESOURCES_PATH = "assets";
|
const QString RESOURCES_PATH = "assets";
|
||||||
|
|
||||||
_resourcesDirectory = QDir(ServerPathUtils::getDataFilePath(RESOURCES_PATH));
|
_resourcesDirectory = QDir(ServerPathUtils::getDataDirectory()).filePath(RESOURCES_PATH);
|
||||||
if (!_resourcesDirectory.exists()) {
|
if (!_resourcesDirectory.exists()) {
|
||||||
qDebug() << "Asset resources directory not found, searching for existing asset resources";
|
qDebug() << "Asset resources directory not found, searching for existing asset resources";
|
||||||
QString oldDataDirectory = QCoreApplication::applicationDirPath();
|
QString oldDataDirectory = QCoreApplication::applicationDirPath();
|
||||||
auto oldResourcesDirectory = QDir(oldDataDirectory).filePath(OLD_RESOURCES_PATH);
|
auto oldResourcesDirectory = QDir(oldDataDirectory).filePath(RESOURCES_PATH);
|
||||||
|
|
||||||
if (QDir(oldResourcesDirectory).exists()) {
|
if (QDir(oldResourcesDirectory).exists()) {
|
||||||
qDebug() << "Existing assets found in " << oldResourcesDirectory << ", copying to " << _resourcesDirectory;
|
qDebug() << "Existing assets found in " << oldResourcesDirectory << ", copying to " << _resourcesDirectory;
|
||||||
|
|
||||||
|
|
||||||
|
QDir resourcesParentDirectory = _resourcesDirectory.filePath("..");
|
||||||
|
if (!resourcesParentDirectory.exists()) {
|
||||||
|
qDebug() << "Creating data directory " << resourcesParentDirectory.absolutePath();
|
||||||
|
resourcesParentDirectory.mkpath(".");
|
||||||
|
}
|
||||||
|
|
||||||
QFile::copy(oldResourcesDirectory, _resourcesDirectory.absolutePath());
|
QFile::copy(oldResourcesDirectory, _resourcesDirectory.absolutePath());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue