VCMIDirs.h 851 B

12345678910111213141516171819202122232425262728293031323334353637
  1. /*
  2. * UserHome.h, part of VCMI engine
  3. *
  4. * Authors: listed in file AUTHORS in main folder
  5. *
  6. * License: GNU General Public License v2.0 or later
  7. * Full text of license available in license.txt file, in main folder
  8. *
  9. */
  10. #ifndef _WIN32 //we need boost here only on non-win platforms
  11. #include <boost/filesystem.hpp>
  12. using namespace boost::filesystem;
  13. #endif
  14. /// Where to find the various VCMI files. This is mostly usefull for linux.
  15. class VCMIDirs {
  16. public:
  17. std::string UserPath;
  18. VCMIDirs()
  19. {
  20. #ifdef _WIN32
  21. UserPath = DATA_DIR;
  22. #else
  23. // Find vcmi user directory and create it if necessary
  24. std::string home_dir = getenv("HOME");
  25. UserPath = path(home_dir + "/.vcmi").string();
  26. create_directory(UserPath);
  27. create_directory(UserPath + "/config");
  28. create_directory(UserPath + "/Games");
  29. #endif
  30. }
  31. };
  32. extern VCMIDirs GVCMIDirs;