From 1eb2e8deaa7cf6f192daac580c7e9e357095dab0 Mon Sep 17 00:00:00 2001 From: Sandy Carter Date: Fri, 14 Aug 2015 21:08:40 -0400 Subject: [PATCH] Strip out protocol substring for file download --- main.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/main.cpp b/main.cpp index 8414012..6a941b9 100644 --- a/main.cpp +++ b/main.cpp @@ -149,7 +149,7 @@ int main(int argc, char *argv[]) ("no-cover", bpo::value(&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(&config.bUpdateCache)->zero_tokens()->default_value(false), "Update game details cache") ("no-platform-detection", bpo::value(&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(&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(&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(&config.bShowWishlist)->zero_tokens()->default_value(false), "Show wishlist") ("login-api", bpo::value(&config.bLoginAPI)->zero_tokens()->default_value(false), "Login (API only)") ("login-website", bpo::value(&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