launcherdirs.cpp 711 B

12345678910111213141516171819202122232425262728293031323334353637
  1. /*
  2. * launcherdirs.cpp, 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 "StdInc.h"
  11. #include "launcherdirs.h"
  12. #include "../lib/VCMIDirs.h"
  13. namespace CLauncherDirs
  14. {
  15. void prepare()
  16. {
  17. for(auto path : {downloadsPath(), modsPath(), mapsPath()})
  18. QDir{}.mkdir(path);
  19. }
  20. QString downloadsPath()
  21. {
  22. return pathToQString(VCMIDirs::get().userCachePath() / "downloads");
  23. }
  24. QString modsPath()
  25. {
  26. return pathToQString(VCMIDirs::get().userDataPath() / "Mods");
  27. }
  28. QString mapsPath()
  29. {
  30. return pathToQString(VCMIDirs::get().userDataPath() / "Maps");
  31. }
  32. }