removing one of the two download functions
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@5612 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
5b20361094
commit
362abc0fc4
@ -27,29 +27,16 @@
|
||||
#include "io/file_manager.hpp"
|
||||
|
||||
// ------------------------------------------------------------------------------------------------------
|
||||
void download(std::string file)
|
||||
void download(std::string file, std::string save)
|
||||
{
|
||||
CURL *session = curl_easy_init();
|
||||
std::cout << "Downloading: " << std::string(UserConfigParams::m_server_addons.toString() + "/" + file) << std::endl;
|
||||
curl_easy_setopt(session, CURLOPT_URL, std::string(UserConfigParams::m_server_addons.toString() + "/" + file).c_str());
|
||||
|
||||
FILE * fp = fopen(std::string(file_manager->getConfigDir() + std::string("/") + file).c_str(), "w");
|
||||
curl_easy_setopt(session, CURLOPT_WRITEDATA, fp);
|
||||
curl_easy_setopt(session, CURLOPT_WRITEFUNCTION, fwrite);
|
||||
curl_easy_perform(session);
|
||||
fclose(fp);
|
||||
curl_easy_cleanup(session);
|
||||
std::cout << UserConfigParams::m_server_addons.toString() << std::endl;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------------
|
||||
void download(std::string file, std::string save)
|
||||
{
|
||||
CURL *session = curl_easy_init();
|
||||
std::cout << "Downloading: " << std::string(UserConfigParams::m_server_addons.toString() + "/" + file) << std::endl;
|
||||
curl_easy_setopt(session, CURLOPT_URL, std::string(UserConfigParams::m_server_addons.toString() + "/" + file).c_str());
|
||||
|
||||
FILE * fp = fopen(std::string(file_manager->getConfigDir() + std::string("/") + save).c_str(), "w");
|
||||
FILE * fp;
|
||||
if(save != "")
|
||||
fp = fopen(std::string(file_manager->getConfigDir() + std::string("/") + save).c_str(), "w");
|
||||
else
|
||||
fp = fopen(std::string(file_manager->getConfigDir() + std::string("/") + file).c_str(), "w");
|
||||
curl_easy_setopt(session, CURLOPT_WRITEDATA, fp);
|
||||
curl_easy_setopt(session, CURLOPT_WRITEFUNCTION, fwrite);
|
||||
curl_easy_perform(session);
|
||||
|
@ -21,11 +21,7 @@
|
||||
#define HEADER_NETWORK_HPP
|
||||
|
||||
/** Download a file. The file name isn't absolute, the server in the config will be added to file. */
|
||||
void download(std::string file);
|
||||
|
||||
/** Download a file with a specific destination. */
|
||||
|
||||
void download(std::string file, std::string out);
|
||||
void download(std::string file, std::string save = "");
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
@ -583,3 +583,10 @@ void FileManager::listFiles(std::set<std::string>& result, const std::string& di
|
||||
} // listFiles
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#ifdef ADDONS_MANAGER
|
||||
void FileManager::checkAndCreateDirForAddons(std::string addons_path)
|
||||
{
|
||||
checkAndCreateDirectory(getAddonsDir() + "/data/" + addons_path);
|
||||
}
|
||||
#endif
|
||||
|
@ -80,6 +80,7 @@ public:
|
||||
std::string getConfigDir () const;
|
||||
#ifdef ADDONS_MANAGER
|
||||
std::string getAddonsDir () const;
|
||||
void checkAndCreateDirForAddons(std::string addons_path);
|
||||
#endif
|
||||
std::string getKartDir () const;
|
||||
std::string getDataDir () const;
|
||||
|
Loading…
Reference in New Issue
Block a user