Power System Platform  2026w11a-beta
Loading...
Searching...
No Matches
Paths Class Reference

Static Public Member Functions

static wxString GetExecutablePath ()
 
static wxString GetExecutableDir ()
 
static wxString GetDataPath ()
 
static wxString GetDocumentsPath ()
 

Detailed Description

Definition at line 23 of file Path.h.

Member Function Documentation

◆ GetDataPath()

wxString Paths::GetDataPath ( )
static

Definition at line 36 of file Path.cpp.

37{
38 wxFileName exe(wxStandardPaths::Get().GetExecutablePath());
39
40 // 1. Installed layout (bin/../share/psp-ufu/data)
41 wxString installData = exe.GetPath() + "/../share/psp-ufu/data";
42
43 wxFileName fnInstall(installData);
44 fnInstall.Normalize(wxPATH_NORM_DOTS);
45
46 if (wxDirExists(fnInstall.GetFullPath()))
47 return fnInstall.GetFullPath();
48
49 // 2. macOS / AppImage resources
50 wxString resources = wxStandardPaths::Get().GetResourcesDir() + "/data";
51
52 if (wxDirExists(resources))
53 return resources;
54
55 // 3. Standard Linux install (/usr/share/psp-ufu/data)
56 wxString dataDir = wxStandardPaths::Get().GetDataDir() + "/data";
57
58 if (wxDirExists(dataDir))
59 return dataDir;
60
61 // 4. Portable layout (Windows or development build)
62 wxString portable = exe.GetPath() + "/../data";
63
64 wxFileName fn(portable);
65 fn.Normalize(wxPATH_NORM_DOTS);
66
67 if (wxDirExists(fn.GetFullPath()))
68 return fn.GetFullPath();
69
70 wxMessageDialog msgDialog(nullptr,
71 _("Data directory not found."),
72 _("Error"),
73 wxOK | wxCENTRE | wxICON_ERROR);
74
75 msgDialog.ShowModal();
76
77 return "";
78}

◆ GetDocumentsPath()

wxString Paths::GetDocumentsPath ( )
static

Definition at line 80 of file Path.cpp.

81{
82 return wxStandardPaths::Get().GetDocumentsDir();
83}

◆ GetExecutableDir()

wxString Paths::GetExecutableDir ( )
static

Definition at line 30 of file Path.cpp.

31{
32 wxFileName exe(wxStandardPaths::Get().GetExecutablePath());
33 return exe.GetPath();
34}

◆ GetExecutablePath()

wxString Paths::GetExecutablePath ( )
static

Definition at line 25 of file Path.cpp.

26{
27 return wxStandardPaths::Get().GetExecutablePath();
28}

The documentation for this class was generated from the following files: