1 #include "MacOSAppSelf.h"
2 #include "../Core/File.h"
11 MacOSAppSelf::MacOSAppSelf(int argc
, char * argv
[], char * apple
[]) {
12 _location
= String(apple
[0]);
15 const File
& MacOSAppSelf::bundle() {
16 static File f
= File(_location
).parent().parent().parent();
20 const File
& MacOSAppSelf::resourceDir() {
21 static File f
= bundle() / "Contents/Resources";
25 const File
MacOSAppSelf::resource(String rsc
) {
26 return resourceDir() / rsc
;
29 const File
& MacOSAppSelf::libraryDir() {
30 static File f
= bundle() / "Contents/Frameworks";
34 const File
& MacOSAppSelf::pluginDir() {
35 static File f
= bundle() / "Contents/Plugins";
39 const File
& MacOSAppSelf::plugindisabledDir() {
40 static File f
= bundle() / "Contents/Plugins-Disabled";
44 const File
& MacOSAppSelf::systemLibraryDir() {
45 static File f
= "/Library";
49 const File
& MacOSAppSelf::systemSettings() {
50 static File f
= "/Library/Preferences/" + appName() + ".prp";
54 const File
& MacOSAppSelf::systemSettingsDir() {
55 static File f
= "/Library/Preferences";
59 const File
& MacOSAppSelf::systemPluginDir() {
60 static File f
= systemResource("Plugins");
64 const File
& MacOSAppSelf::systemPluginDisabledDir() {
65 static File f
= systemResource("Plugins-Disabled");
69 const File
& MacOSAppSelf::systemResourceDir() {
70 static File f
= "/Library/Application Support/"+appName();
74 const File
MacOSAppSelf::systemResource(String rsc
) {
75 return systemResourceDir() / rsc
;
78 const File
& MacOSAppSelf::userHome() {
79 static File f
= getpwuid(geteuid())->pw_dir
;
83 const File
& MacOSAppSelf::userLibraryDir() {
84 static File f
= userHome() / "Library";
88 const File
& MacOSAppSelf::userSettings() {
89 static File f
= userLibraryDir() / ("Preferences/"+appName() + ".prp");
93 const File
& MacOSAppSelf::userSettingsDir() {
94 static File f
= userLibraryDir() / "Preferences";
98 const File
& MacOSAppSelf::userPluginDir() {
99 static File f
= userResource("Plugins");
103 const File
& MacOSAppSelf::userPluginDisabledDir() {
104 static File f
= userResource("Plugins-Disabled");
108 const File
& MacOSAppSelf::userResourceDir() {
109 static File f
= userLibraryDir() / ("Application Support/" + appName());
113 const File
MacOSAppSelf::userResource(String rsc
) {
114 return userResourceDir() / rsc
;
117 const File
& MacOSAppSelf::prefix() {
118 static File f
= File(_location
).parent().parent();
124 #endif // SYLPH_OS_MACOSX