Strip out protocol substring for file download

This commit is contained in:
Sandy Carter 2015-08-14 21:08:40 -04:00
parent fe314869c1
commit 1eb2e8deaa

View File

@ -149,7 +149,7 @@ int main(int argc, char *argv[])
("no-cover", bpo::value<bool>(&bNoCover)->zero_tokens()->default_value(false), "Don't download cover images. Overrides --cover option.\nUseful for making exceptions when \"cover\" is set to true in config file.")
("update-cache", bpo::value<bool>(&config.bUpdateCache)->zero_tokens()->default_value(false), "Update game details cache")
("no-platform-detection", bpo::value<bool>(&bNoPlatformDetection)->zero_tokens()->default_value(false), "Don't try to detect supported platforms from game shelf.\nSkips the initial fast platform detection and detects the supported platforms from game details which is slower but more accurate.\nUseful in case platform identifier is missing for some games in the game shelf.\nUsing --platform with --list doesn't work with this option.")
("download-file", bpo::value<std::string>(&config.sFileIdString)->default_value(""), "Download a single file using fileid\nFormat: \"gamename/fileid\"\nThis option ignores all subdir options. The file is downloaded to directory specified with --directory option.")
("download-file", bpo::value<std::string>(&config.sFileIdString)->default_value(""), "Download a single file using fileid\nFormat: \"gamename/fileid\"\nor: \"gogdownloader://gamename/fileid\"\nThis option ignores all subdir options. The file is downloaded to directory specified with --directory option.")
("wishlist", bpo::value<bool>(&config.bShowWishlist)->zero_tokens()->default_value(false), "Show wishlist")
("login-api", bpo::value<bool>(&config.bLoginAPI)->zero_tokens()->default_value(false), "Login (API only)")
("login-website", bpo::value<bool>(&config.bLoginHTTP)->zero_tokens()->default_value(false), "Login (website only)")
@ -510,7 +510,12 @@ int main(int argc, char *argv[])
else if (config.bUpdateCheck) // Update check has priority over download and list
downloader.updateCheck();
else if (!config.sFileIdString.empty())
downloader.downloadFileWithId(config.sFileIdString);
{
if (config.sFileIdString.compare(0, GlobalConstants::PROTOCOL_PREFIX.length(), GlobalConstants::PROTOCOL_PREFIX) == 0)
downloader.downloadFileWithId(config.sFileIdString.substr(GlobalConstants::PROTOCOL_PREFIX.length(), config.sFileIdString.length()));
else
downloader.downloadFileWithId(config.sFileIdString);
}
else if (config.bRepair) // Repair file
downloader.repair();
else if (config.bDownload) // Download games