You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

WBTmp.cpp 587B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #include "WBTmp.h"
  2. #include <QApplication>
  3. WBTmp *WBTmp::_this = nullptr;
  4. WBTmp::WBTmp()
  5. {
  6. _tmpDir = "/tmp/WineBottle/" + QString::number(QApplication::applicationPid()) + "/";
  7. if (!_tmpDir.exists())
  8. _tmpDir.mkpath(_tmpDir.path());
  9. }
  10. WBTmp::~WBTmp()
  11. {
  12. if (!_tmpDir.exists())
  13. _tmpDir.rmdir(_tmpDir.path());
  14. }
  15. WBTmp *WBTmp::Instance()
  16. {
  17. if (!_this)
  18. _this = new WBTmp();
  19. return _this;
  20. }
  21. void WBTmp::DeleteInstance()
  22. {
  23. if (_this)
  24. delete _this;
  25. }
  26. QString WBTmp::tmpPath()
  27. {
  28. return _tmpDir.path();
  29. }
  30. const QDir &WBTmp::tmp()
  31. {
  32. return const_cast<const QDir&>(_tmpDir);
  33. }