diff options
author | Eugenio Favalli <elvenprogrammer@gmail.com> | 2005-07-15 21:29:07 +0000 |
---|---|---|
committer | Eugenio Favalli <elvenprogrammer@gmail.com> | 2005-07-15 21:29:07 +0000 |
commit | 81aee6c4c85649793d9cf38f5a5bc1bdfffdd78e (patch) | |
tree | cce1529b567a15ee1c888dd9efc3e18a1b139c71 /src/gui/updatewindow.cpp | |
parent | 2723b8680ac1c56aff73e775256b36ca0a88a3e9 (diff) | |
download | mana-81aee6c4c85649793d9cf38f5a5bc1bdfffdd78e.tar.gz mana-81aee6c4c85649793d9cf38f5a5bc1bdfffdd78e.tar.bz2 mana-81aee6c4c85649793d9cf38f5a5bc1bdfffdd78e.tar.xz mana-81aee6c4c85649793d9cf38f5a5bc1bdfffdd78e.zip |
- Adding joypad tolerance to config file
- Trying to put updates in the data folder (is this the right way?)
Diffstat (limited to 'src/gui/updatewindow.cpp')
-rw-r--r-- | src/gui/updatewindow.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/gui/updatewindow.cpp b/src/gui/updatewindow.cpp index e571f3fc..7ee84016 100644 --- a/src/gui/updatewindow.cpp +++ b/src/gui/updatewindow.cpp @@ -130,7 +130,7 @@ void UpdaterWindow::loadNews() browserBox->clearRows(); ResourceManager *resman = ResourceManager::getInstance(); int contentsLength; - std::ifstream newsFile("news.txt"); + std::ifstream newsFile(TMW_DATADIR "data/news.txt"); if (!newsFile.is_open()) { logger->log("Couldn't load news.txt"); @@ -187,7 +187,7 @@ int downloadThread(void *ptr) // Download current file as a temp file logger->log("Downloading: %s", url.c_str()); // TODO: download in the proper folder (data?) - outfile = fopen("download.temp", "wb"); + outfile = fopen(TMW_DATADIR "data/download.temp", "wb"); curl_easy_setopt(curl, CURLOPT_URL, url.c_str()); curl_easy_setopt(curl, CURLOPT_WRITEDATA, outfile); curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0); @@ -205,7 +205,9 @@ int downloadThread(void *ptr) else { // If the download was successful give the file the proper name // else it will be deleted later - rename("download.temp", currentFile.c_str()); + std::string newName(TMW_DATADIR "data/"); + newName += currentFile.c_str(); + rename(TMW_DATADIR "data/download.temp", newName.c_str()); } } @@ -305,7 +307,7 @@ void updateData() if (!in.is_open()) { // Try to open resources.txt - in.open("resources.txt"); + in.open(TMW_DATADIR "data/resources.txt"); if (!in.is_open()) { logger->log("Unable to open resources.txt"); @@ -350,9 +352,9 @@ void updateData() in.close(); // Remove downloaded files - remove("news.txt"); - remove("resources.txt"); - remove("download.temp"); + remove(TMW_DATADIR "data/news.txt"); + remove(TMW_DATADIR "data/resources.txt"); + remove(TMW_DATADIR "data/download.temp"); delete updaterWindow; } |