convpathqstring.h 672 B

1234567891011121314151617181920212223242526272829
  1. /*
  2. * convpathqstring.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. #pragma once
  11. inline QString pathToQString(const boost::filesystem::path & path)
  12. {
  13. #ifdef VCMI_WINDOWS
  14. return QString::fromStdWString(path.wstring());
  15. #else
  16. return QString::fromStdString(path.string());
  17. #endif
  18. }
  19. inline boost::filesystem::path qstringToPath(const QString & path)
  20. {
  21. #ifdef VCMI_WINDOWS
  22. return boost::filesystem::path(path.toStdWString());
  23. #else
  24. return boost::filesystem::path(path.toUtf8().data());
  25. #endif
  26. }