summaryrefslogtreecommitdiffstats
path: root/logic/OneSixInstance.cpp
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2014-01-18 22:11:33 +0100
committerPetr Mrázek <peterix@gmail.com>2014-01-18 22:11:33 +0100
commit3fabb11f4c59baffb14db00d338d9efe342e277e (patch)
treec33d242761d31879f12821daab4d4f714a47b698 /logic/OneSixInstance.cpp
parent8650aa81f06d9e229764b200f1dca135412c2ec1 (diff)
downloadMultiMC-3fabb11f4c59baffb14db00d338d9efe342e277e.tar
MultiMC-3fabb11f4c59baffb14db00d338d9efe342e277e.tar.gz
MultiMC-3fabb11f4c59baffb14db00d338d9efe342e277e.tar.lz
MultiMC-3fabb11f4c59baffb14db00d338d9efe342e277e.tar.xz
MultiMC-3fabb11f4c59baffb14db00d338d9efe342e277e.zip
Marginally improve OneSix offline mode launch
While reconstructing assets, skip files that don't exist. Report missing OneSix native libraries.
Diffstat (limited to 'logic/OneSixInstance.cpp')
-rw-r--r--logic/OneSixInstance.cpp55
1 files changed, 27 insertions, 28 deletions
diff --git a/logic/OneSixInstance.cpp b/logic/OneSixInstance.cpp
index 16699a1d..3cfc1c76 100644
--- a/logic/OneSixInstance.cpp
+++ b/logic/OneSixInstance.cpp
@@ -93,39 +93,38 @@ QDir OneSixInstance::reconstructAssets(std::shared_ptr<OneSixVersion> version)
AssetsIndex index;
bool loadAssetsIndex = AssetsUtils::loadAssetsIndexJson(indexPath, &index);
- if (loadAssetsIndex)
+ if (loadAssetsIndex && index.isVirtual)
{
- if (index.isVirtual)
- {
- QLOG_INFO() << "Reconstructing virtual assets folder at" << virtualRoot.path();
+ QLOG_INFO() << "Reconstructing virtual assets folder at" << virtualRoot.path();
- for (QString map : index.objects.keys())
+ for (QString map : index.objects.keys())
+ {
+ AssetObject asset_object = index.objects.value(map);
+ QString target_path = PathCombine(virtualRoot.path(), map);
+ QFile target(target_path);
+
+ QString tlk = asset_object.hash.left(2);
+
+ QString original_path =
+ PathCombine(PathCombine(objectDir.path(), tlk), asset_object.hash);
+ QFile original(original_path);
+ if(!original.exists())
+ continue;
+ if (!target.exists())
{
- AssetObject asset_object = index.objects.value(map);
- QString target_path = PathCombine(virtualRoot.path(), map);
- QFile target(target_path);
-
- QString tlk = asset_object.hash.left(2);
-
- QString original_path =
- PathCombine(PathCombine(objectDir.path(), tlk), asset_object.hash);
- QFile original(original_path);
- if (!target.exists())
- {
- QFileInfo info(target_path);
- QDir target_dir = info.dir();
- // QLOG_DEBUG() << target_dir;
- if (!target_dir.exists())
- QDir("").mkpath(target_dir.path());
-
- bool couldCopy = original.copy(target_path);
- QLOG_DEBUG() << " Copying" << original_path << "to" << target_path
- << QString::number(couldCopy); // << original.errorString();
- }
+ QFileInfo info(target_path);
+ QDir target_dir = info.dir();
+ // QLOG_DEBUG() << target_dir;
+ if (!target_dir.exists())
+ QDir("").mkpath(target_dir.path());
+
+ bool couldCopy = original.copy(target_path);
+ QLOG_DEBUG() << " Copying" << original_path << "to" << target_path
+ << QString::number(couldCopy); // << original.errorString();
}
-
- // TODO: Write last used time to virtualRoot/.lastused
}
+
+ // TODO: Write last used time to virtualRoot/.lastused
}
return virtualRoot;