VCMIDirs.h 780 B

1234567891011121314151617181920212223242526272829303132333435
  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. #include <boost/filesystem.hpp>
  11. using namespace boost::filesystem;
  12. /* Where to find the various VCMI files. This is mostly usefull for linux. */
  13. class VCMIDirs {
  14. public:
  15. std::string UserPath;
  16. VCMIDirs()
  17. {
  18. #ifdef _WIN32
  19. UserPath = DATA_DIR;
  20. #else
  21. // Find vcmi user directory and create it if necessary
  22. std::string home_dir = getenv("HOME");
  23. UserPath = path(home_dir + "/.vcmi").string();
  24. create_directory(UserPath);
  25. create_directory(UserPath + "/config");
  26. create_directory(UserPath + "/Games");
  27. #endif
  28. }
  29. };
  30. extern VCMIDirs GVCMIDirs;