summaryrefslogtreecommitdiff
path: root/src/porting.cpp
Commit message (Collapse)AuthorAge
* Tune queue limits, some other adjustmentskwolekr2013-02-25
|
* Add multi-Emerge thread supportkwolekr2013-02-25
|
* Update Copyright YearsSfan52013-02-24
|
* Change Minetest-c55 to MinetestPilzAdam2013-02-24
|
* Fix assertion condition in initializePaths()kwolekr2013-02-06
|
* Fix msvc buildIlya Zhuravlev2013-01-22
|
* Proper RUN_IN_PLACE support for OSX and FreeBSDkwolekr2013-01-21
|
* Improve build configuration optionsPerttu Ahola2012-07-23
|
* Initially split utility.h to multiple files in util/Perttu Ahola2012-06-17
|
* Switch the license to be LGPLv2/later, with small parts still remaining as ↵Perttu Ahola2012-06-05
| | | | GPLv2/later, by agreement of major contributors
* MSVC build directory autodetection at startupPerttu Ahola2012-03-25
|
* Flatten share/ and user/ in the source and for the RUN_IN_PLACE buildPerttu Ahola2012-03-20
|
* Attempt to fix RUN_IN_PLACE autodetection on LinuxPerttu Ahola2012-03-13
|
* Remove useless debug output (log at info level)Perttu Ahola2012-03-11
|
* Clean up log messages everywherePerttu Ahola2012-03-11
|
* Initial directory structure reworkPerttu Ahola2012-03-10
|
* Scripting WIPPerttu Ahola2011-11-29
|
* Move images to data/textures and fix some path stuff; hope that installation ↵Perttu Ahola2011-11-29
| | | | still works
* Command-line signal handling for WindowsConstantin Wenger2011-11-06
|
* Remove trailing / or \ in path_userdata (probably fixes world deletion on ↵Perttu Ahola2011-11-02
| | | | Windows)
* Fix map delete on windows (concatenate paths correctly with / or \ depending ↵Perttu Ahola2011-10-16
| | | | on OS)
* fixed not finding data dir if installedConstantin Wenger2011-08-12
|
* Fix data paths for FreeBSDDmitry Marakasov2011-08-02
|
* Check the data path before usageGiuseppe Bilotta2011-07-20
| | | | | | | When not running in place, check if the assumed data path in ../share/APPNAME exists. If it doesn't exist, fall back to ../data instead. This allows the program to run successfully from the checkout directory even without the run-in-place flag active.
* moved the mac include in porting.cpp out of namespacePerttu Ahola2011-06-20
|
* Hand-picked Mac OSX cursor and bundle path fixes from ↵Perttu Ahola2011-06-18
| | | | https://bitbucket.org/toabi/minetest-mac
* Get rid of ignored return value warningCiaran Gultnieks2011-05-16
|
* mainly work on object scripting apiPerttu Ahola2011-02-23
|
* Debug stacks will now be printed on Ctrl-C. Also client properly quits on ↵Perttu Ahola2011-02-16
| | | | Ctrl-C.
* Fix for windowsPerttu Ahola2011-02-15
|
* Ctrl+C handling on POSIX, some commands for server and other tweakingPerttu Ahola2011-02-15
|
* bug-fixin'Perttu Ahola2011-02-08
|
* fixed data path in porting.cpp for normal linux builds to get data from ↵Perttu Ahola2011-01-10
| | | | /binary/dir/../share/APPNAME
* CMake stuff works now on linux and windows... and should be possible to make ↵Perttu Ahola2011-01-08
| | | | to work on OS X.
* Added a more flexible path system (and fixed some minor stuff)Perttu Ahola2011-01-07
on data " << reader.getFormattedErrorMessages(); if (fetch_result.data.size() > 100) { errorstream << "Data (" << fetch_result.data.size() << " bytes) printed to warningstream." << std::endl; warningstream << "data: \"" << fetch_result.data << "\"" << std::endl; } else { errorstream << "data: \"" << fetch_result.data << "\"" << std::endl; } return Json::Value(); } return root; } std::vector<ModStoreMod> readModStoreList(Json::Value& modlist) { std::vector<ModStoreMod> retval; if (modlist.isArray()) { for (unsigned int i = 0; i < modlist.size(); i++) { ModStoreMod toadd; toadd.valid = true; //id if (modlist[i]["id"].asString().size()) { std::string id_raw = modlist[i]["id"].asString(); char* endptr = 0; int numbervalue = strtol(id_raw.c_str(),&endptr,10); if ((id_raw != "") && (*endptr == 0)) { toadd.id = numbervalue; } else { errorstream << "readModStoreList: missing id" << std::endl; toadd.valid = false; } } else { errorstream << "readModStoreList: missing id" << std::endl; toadd.valid = false; } //title if (modlist[i]["title"].asString().size()) { toadd.title = modlist[i]["title"].asString(); } else { errorstream << "readModStoreList: missing title" << std::endl; toadd.valid = false; } //basename if (modlist[i]["basename"].asString().size()) { toadd.basename = modlist[i]["basename"].asString(); } else { errorstream << "readModStoreList: missing basename" << std::endl; toadd.valid = false; } //author //rating //version if (toadd.valid) { retval.push_back(toadd); } } } return retval; } ModStoreModDetails readModStoreModDetails(Json::Value& details) { ModStoreModDetails retval; retval.valid = true; //version set if (details["version_set"].isArray()) { for (unsigned int i = 0; i < details["version_set"].size(); i++) { ModStoreVersionEntry toadd; if (details["version_set"][i]["id"].asString().size()) { std::string id_raw = details["version_set"][i]["id"].asString(); char* endptr = 0; int numbervalue = strtol(id_raw.c_str(),&endptr,10); if ((id_raw != "") && (*endptr == 0)) { toadd.id = numbervalue; } } else { errorstream << "readModStoreModDetails: missing version_set id" << std::endl; retval.valid = false; } //date if (details["version_set"][i]["date"].asString().size()) { toadd.date = details["version_set"][i]["date"].asString(); } //file if (details["version_set"][i]["file"].asString().size()) { toadd.file = details["version_set"][i]["file"].asString(); } else { errorstream << "readModStoreModDetails: missing version_set file" << std::endl; retval.valid = false; } //approved //mtversion if( retval.valid ) { retval.versions.push_back(toadd); } else { break; } } } if (retval.versions.size() < 1) { infostream << "readModStoreModDetails: not a single version specified!" << std::endl; retval.valid = false; } //categories if (details["categories"].isObject()) { for (unsigned int i = 0; i < details["categories"].size(); i++) { ModStoreCategoryInfo toadd; if (details["categories"][i]["id"].asString().size()) { std::string id_raw = details["categories"][i]["id"].asString(); char* endptr = 0; int numbervalue = strtol(id_raw.c_str(),&endptr,10); if ((id_raw != "") && (*endptr == 0)) { toadd.id = numbervalue; } } else { errorstream << "readModStoreModDetails: missing categories id" << std::endl; retval.valid = false; } if (details["categories"][i]["title"].asString().size()) { toadd.name = details["categories"][i]["title"].asString(); } else { errorstream << "readModStoreModDetails: missing categories title" << std::endl; retval.valid = false; } if( retval.valid ) { retval.categories.push_back(toadd); } else { break; } } } //author if (details["author"].isObject()) { if (details["author"]["id"].asString().size()) { std::string id_raw = details["author"]["id"].asString(); char* endptr = 0; int numbervalue = strtol(id_raw.c_str(),&endptr,10); if ((id_raw != "") && (*endptr == 0)) { retval.author.id = numbervalue; } else { errorstream << "readModStoreModDetails: missing author id (convert)" << std::endl; retval.valid = false; } } else { errorstream << "readModStoreModDetails: missing author id" << std::endl; retval.valid = false; } if (details["author"]["username"].asString().size()) { retval.author.username = details["author"]["username"].asString(); } else { errorstream << "readModStoreModDetails: missing author username" << std::endl; retval.valid = false; } } else { errorstream << "readModStoreModDetails: missing author" << std::endl; retval.valid = false; } //license if (details["license"].isObject()) { if (details["license"]["id"].asString().size()) { std::string id_raw = details["license"]["id"].asString(); char* endptr = 0; int numbervalue = strtol(id_raw.c_str(),&endptr,10); if ((id_raw != "") && (*endptr == 0)) { retval.license.id = numbervalue; } } else { errorstream << "readModStoreModDetails: missing license id" << std::endl; retval.valid = false; } if (details["license"]["short"].asString().size()) { retval.license.shortinfo = details["license"]["short"].asString(); } else { errorstream << "readModStoreModDetails: missing license short" << std::endl; retval.valid = false; } if (details["license"]["link"].asString().size()) { retval.license.url = details["license"]["link"].asString(); } } //titlepic if (details["titlepic"].isObject()) { if (details["titlepic"]["id"].asString().size()) { std::string id_raw = details["titlepic"]["id"].asString(); char* endptr = 0; int numbervalue = strtol(id_raw.c_str(),&endptr,10); if ((id_raw != "") && (*endptr == 0)) { retval.titlepic.id = numbervalue; } } if (details["titlepic"]["file"].asString().size()) { retval.titlepic.file = details["titlepic"]["file"].asString(); } if (details["titlepic"]["desc"].asString().size()) { retval.titlepic.description = details["titlepic"]["desc"].asString(); } if (details["titlepic"]["mod"].asString().size()) { std::string mod_raw = details["titlepic"]["mod"].asString(); char* endptr = 0; int numbervalue = strtol(mod_raw.c_str(),&endptr,10); if ((mod_raw != "") && (*endptr == 0)) { retval.titlepic.mod = numbervalue; } } } //id if (details["id"].asString().size()) { std::string id_raw = details["id"].asString(); char* endptr = 0; int numbervalue = strtol(id_raw.c_str(),&endptr,10); if ((id_raw != "") && (*endptr == 0)) { retval.id = numbervalue; } } else { errorstream << "readModStoreModDetails: missing id" << std::endl; retval.valid = false; } //title if (details["title"].asString().size()) { retval.title = details["title"].asString(); } else { errorstream << "readModStoreModDetails: missing title" << std::endl; retval.valid = false; } //basename if (details["basename"].asString().size()) { retval.basename = details["basename"].asString(); } else { errorstream << "readModStoreModDetails: missing basename" << std::endl; retval.valid = false; } //description if (details["desc"].asString().size()) { retval.description = details["desc"].asString(); } //repository if (details["replink"].asString().size()) { retval.repository = details["replink"].asString(); } //value if (details["value"].isInt()) { retval.rating = details["value"].asInt(); } else { retval.rating = 0; } //depends if (details["depends"].isArray()) { //TODO } //softdepends if (details["softdep"].isArray()) { //TODO } //screenshot url if (details["screenshot_url"].asString().size()) { retval.screenshot_url = details["screenshot_url"].asString(); } return retval; }