20#include <wx/stdpaths.h>
21#include <wx/filename.h>
25wxString Paths::GetExecutablePath()
27 return wxStandardPaths::Get().GetExecutablePath();
30wxString Paths::GetExecutableDir()
32 wxFileName exe(wxStandardPaths::Get().GetExecutablePath());
36wxString Paths::GetDataPath()
38 wxFileName exe(wxStandardPaths::Get().GetExecutablePath());
41 wxString installData = exe.GetPath() +
"/../share/psp-ufu/data";
43 wxFileName fnInstall(installData);
44 fnInstall.Normalize(wxPATH_NORM_DOTS);
46 if (wxDirExists(fnInstall.GetFullPath()))
47 return fnInstall.GetFullPath();
50 wxString resources = wxStandardPaths::Get().GetResourcesDir() +
"/data";
52 if (wxDirExists(resources))
56 wxString dataDir = wxStandardPaths::Get().GetDataDir() +
"/data";
58 if (wxDirExists(dataDir))
62 wxString portable = exe.GetPath() +
"/../data";
64 wxFileName fn(portable);
65 fn.Normalize(wxPATH_NORM_DOTS);
67 if (wxDirExists(fn.GetFullPath()))
68 return fn.GetFullPath();
70 wxMessageDialog msgDialog(
nullptr,
71 _(
"Data directory not found."),
73 wxOK | wxCENTRE | wxICON_ERROR);
75 msgDialog.ShowModal();
80wxString Paths::GetDocumentsPath()
82 return wxStandardPaths::Get().GetDocumentsDir();