mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 11:37:58 +02:00
Fix ATP file copy
This commit is contained in:
parent
996f3f5df7
commit
c9ea6e7eb6
1 changed files with 15 additions and 2 deletions
|
@ -53,11 +53,16 @@ void AssetServer::run() {
|
||||||
const QString RESOURCES_PATH = "assets";
|
const QString RESOURCES_PATH = "assets";
|
||||||
|
|
||||||
_resourcesDirectory = QDir(ServerPathUtils::getDataDirectory()).filePath(RESOURCES_PATH);
|
_resourcesDirectory = QDir(ServerPathUtils::getDataDirectory()).filePath(RESOURCES_PATH);
|
||||||
if (!_resourcesDirectory.exists()) {
|
|
||||||
|
bool noExistingAssets = !_resourcesDirectory.exists() \
|
||||||
|
|| _resourcesDirectory.entryList(QDir::Dirs | QDir::NoDotAndDotDot | QDir::Files).size() == 0;
|
||||||
|
|
||||||
|
if (noExistingAssets) {
|
||||||
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("resources/" + RESOURCES_PATH);
|
auto oldResourcesDirectory = QDir(oldDataDirectory).filePath("resources/" + 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;
|
||||||
|
|
||||||
|
@ -68,7 +73,15 @@ void AssetServer::run() {
|
||||||
resourcesParentDirectory.mkpath(".");
|
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";
|
qDebug() << "Creating resources directory";
|
||||||
|
|
Loading…
Reference in a new issue