Galaxy: Use install directory from json

Use install directory value from json as subdirectory in directory specified by --directory
If install directory was not set then use product id as subdirectory
This commit is contained in:
Sude 2017-03-05 22:05:08 +02:00
parent d2249ffdc5
commit d4294b6d12

View File

@ -3511,6 +3511,9 @@ void Downloader::galaxyInstallGame(const std::string& product_id, int build_inde
json = gogGalaxy->getManifestV2(buildHash); json = gogGalaxy->getManifestV2(buildHash);
std::string game_title = json["products"][0]["name"].asString(); std::string game_title = json["products"][0]["name"].asString();
std::string install_directory = json["installDirectory"].asString();
if (install_directory.empty())
install_directory = product_id;
std::vector<galaxyDepotItem> items; std::vector<galaxyDepotItem> items;
for (unsigned int i = 0; i < json["depots"].size(); ++i) for (unsigned int i = 0; i < json["depots"].size(); ++i)
@ -3550,7 +3553,7 @@ void Downloader::galaxyInstallGame(const std::string& product_id, int build_inde
for (unsigned int i = 0; i < items.size(); ++i) for (unsigned int i = 0; i < items.size(); ++i)
{ {
boost::filesystem::path path = Globals::globalConfig.dirConf.sDirectory + items[i].path; boost::filesystem::path path = Globals::globalConfig.dirConf.sDirectory + install_directory + "/" + items[i].path;
// Check that directory exists and create it // Check that directory exists and create it
boost::filesystem::path directory = path.parent_path(); boost::filesystem::path directory = path.parent_path();