aboutsummaryrefslogtreecommitdiff
path: root/backends/platform/sdl/macosx
diff options
context:
space:
mode:
authorCameron Cawley2019-12-07 14:08:33 +0000
committerFilippos Karapetis2019-12-07 21:15:41 +0200
commitaa083256ec05ee43d9f1977ca2178cacdfb25ae3 (patch)
treeeaaf0b2788921203c0d0487bcedf4ceb2d5e54ed /backends/platform/sdl/macosx
parentc90164f526b506a59092b48bcf78838777b68544 (diff)
downloadscummvm-rg350-aa083256ec05ee43d9f1977ca2178cacdfb25ae3.tar.gz
scummvm-rg350-aa083256ec05ee43d9f1977ca2178cacdfb25ae3.tar.bz2
scummvm-rg350-aa083256ec05ee43d9f1977ca2178cacdfb25ae3.zip
SDL: Simplify implementations of getDefaultConfigFileName()
Diffstat (limited to 'backends/platform/sdl/macosx')
-rw-r--r--backends/platform/sdl/macosx/macosx.cpp23
-rw-r--r--backends/platform/sdl/macosx/macosx.h2
2 files changed, 19 insertions, 6 deletions
diff --git a/backends/platform/sdl/macosx/macosx.cpp b/backends/platform/sdl/macosx/macosx.cpp
index 1c47401c13..1545d9ab61 100644
--- a/backends/platform/sdl/macosx/macosx.cpp
+++ b/backends/platform/sdl/macosx/macosx.cpp
@@ -45,11 +45,6 @@
#include "ApplicationServices/ApplicationServices.h" // for LSOpenFSRef
#include "CoreFoundation/CoreFoundation.h" // for CF* stuff
-OSystem_MacOSX::OSystem_MacOSX()
- :
- OSystem_POSIX("Library/Preferences/ScummVM Preferences") {
-}
-
OSystem_MacOSX::~OSystem_MacOSX() {
releaseMenu();
}
@@ -205,6 +200,24 @@ Common::String OSystem_MacOSX::getSystemLanguage() const {
#endif // USE_DETECTLANG
}
+Common::String OSystem_MacOSX::getDefaultConfigFileName() {
+ const Common::String baseConfigName = "Library/Preferences/ScummVM Preferences";
+
+ Common::String configFile;
+
+ Common::String prefix = getenv("HOME");
+
+ if (!prefix.empty() && (prefix.size() + 1 + baseConfigName.size()) < MAXPATHLEN) {
+ configFile = prefix;
+ configFile += '/';
+ configFile += baseConfigName;
+ } else {
+ configFile = baseConfigName;
+ }
+
+ return configFile;
+}
+
Common::String OSystem_MacOSX::getDefaultLogFileName() {
const char *prefix = getenv("HOME");
if (prefix == nullptr) {
diff --git a/backends/platform/sdl/macosx/macosx.h b/backends/platform/sdl/macosx/macosx.h
index b860b71ad8..e4b5b2a631 100644
--- a/backends/platform/sdl/macosx/macosx.h
+++ b/backends/platform/sdl/macosx/macosx.h
@@ -27,7 +27,6 @@
class OSystem_MacOSX : public OSystem_POSIX {
public:
- OSystem_MacOSX();
~OSystem_MacOSX();
virtual bool hasFeature(Feature f);
@@ -50,6 +49,7 @@ public:
virtual Common::String getScreenshotsPath();
protected:
+ virtual Common::String getDefaultConfigFileName();
virtual Common::String getDefaultLogFileName();
// Override createAudioCDManager() to get our Mac-specific