mirror of
https://github.com/AleziaKurdis/overte.git
synced 2025-04-14 16:07:01 +02:00
Merge pull request #6892 from huffman/fix-asset-migration
Fix ATP file copy
This commit is contained in:
commit
9127edc968
1 changed files with 15 additions and 2 deletions
|
@ -53,11 +53,16 @@ void AssetServer::run() {
|
|||
const QString RESOURCES_PATH = "assets";
|
||||
|
||||
_resourcesDirectory = QDir(ServerPathUtils::getDataDirectory()).filePath(RESOURCES_PATH);
|
||||
if (!_resourcesDirectory.exists()) {
|
||||
|
||||
bool noExistingAssets = !_resourcesDirectory.exists() \
|
||||
|| _resourcesDirectory.entryList(QDir::Files).size() == 0;
|
||||
|
||||
if (noExistingAssets) {
|
||||
qDebug() << "Asset resources directory not found, searching for existing asset resources";
|
||||
QString oldDataDirectory = QCoreApplication::applicationDirPath();
|
||||
auto oldResourcesDirectory = QDir(oldDataDirectory).filePath("resources/" + RESOURCES_PATH);
|
||||
|
||||
|
||||
if (QDir(oldResourcesDirectory).exists()) {
|
||||
qDebug() << "Existing assets found in " << oldResourcesDirectory << ", copying to " << _resourcesDirectory;
|
||||
|
||||
|
@ -68,7 +73,15 @@ void AssetServer::run() {
|
|||
resourcesParentDirectory.mkpath(".");
|
||||
}
|
||||
|
||||
QFile::copy(oldResourcesDirectory, _resourcesDirectory.absolutePath());
|
||||
auto files = QDir(oldResourcesDirectory).entryList(QDir::Files);
|
||||
|
||||
for (auto& file : files) {
|
||||
auto from = oldResourcesDirectory + QDir::separator() + file;
|
||||
auto to = _resourcesDirectory.absoluteFilePath(file);
|
||||
qDebug() << "\tCopying from " << from << " to " << to;
|
||||
QFile::copy(from, to);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
qDebug() << "Creating resources directory";
|
||||
|
|
Loading…
Reference in a new issue