[Scummvm-git-logs] scummvm master -> 3ffbb3b030db317407c4ca91578aa19cc6d1fe18

sev- noreply at scummvm.org
Sat Jul 2 20:34:42 UTC 2022


This automated email contains information about 8 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
fe001b35b5 COMMON: Adding default iconspath functionality
b5fac9671d COMMON: Add getDefaultIconPath() for Windows
9afd41b195 COMMON: Renaming getDefaultIconPath() -> getDefaultIconsPath()
33389f062e COMMON: Adding comment for default path methods
1cb41b667f COMMON: Putting Icons in a subdirectory if in Win32 portable mode
5ee9618c15 COMMON: Adding prefix to POSIX icon path
3e1d4ae9ce COMMON: Restructuring how ApplicationSupport path is calculated and putting in Icons subdirectory
3ffbb3b030 COMMON: Adding endline to macosx_wrapper.mm


Commit: fe001b35b54185458e2e3fe6fcf81fe1a6848b81
    https://github.com/scummvm/scummvm/commit/fe001b35b54185458e2e3fe6fcf81fe1a6848b81
Author: Thunderforge (wjherrmann at gmail.com)
Date: 2022-07-02T22:34:36+02:00

Commit Message:
COMMON: Adding default iconspath functionality

It's for macOS only right now.

Changed paths:
    backends/platform/sdl/macosx/macosx.cpp
    backends/platform/sdl/macosx/macosx.h
    backends/platform/sdl/posix/posix.cpp
    backends/platform/sdl/posix/posix.h
    backends/platform/sdl/sdl.cpp
    backends/platform/sdl/sdl.h
    gui/downloadiconsdialog.cpp
    gui/gui-manager.cpp
    gui/options.cpp


diff --git a/backends/platform/sdl/macosx/macosx.cpp b/backends/platform/sdl/macosx/macosx.cpp
index 0809ab0d686..1c3ef7349f8 100644
--- a/backends/platform/sdl/macosx/macosx.cpp
+++ b/backends/platform/sdl/macosx/macosx.cpp
@@ -261,6 +261,21 @@ Common::String OSystem_MacOSX::getDefaultLogFileName() {
 	return Common::String(prefix) + "/Library/Logs/scummvm.log";
 }
 
+Common::String OSystem_MacOSX::getDefaultIconPath() {
+	const char *prefix = getenv("HOME");
+	if (prefix == nullptr) {
+		return Common::String();
+	}
+
+	const Common::String appSupportFolder = Common::String(prefix) + "/Library/Application Support/ScummVM";
+
+	if (!Posix::assureDirectoryExists(appSupportFolder)) {
+		return Common::String();
+	}
+
+	return appSupportFolder;
+}
+
 Common::String OSystem_MacOSX::getScreenshotsPath() {
 	// If the user has configured a screenshots path, use it
 	const Common::String path = OSystem_SDL::getScreenshotsPath();
diff --git a/backends/platform/sdl/macosx/macosx.h b/backends/platform/sdl/macosx/macosx.h
index 858e5865191..39b5be253da 100644
--- a/backends/platform/sdl/macosx/macosx.h
+++ b/backends/platform/sdl/macosx/macosx.h
@@ -48,7 +48,7 @@ public:
 	GraphicsManagerType getDefaultGraphicsManager() const override;
 #endif
 
-	//Screenshots
+	Common::String getDefaultIconPath() override;
 	Common::String getScreenshotsPath() override;
 
 protected:
diff --git a/backends/platform/sdl/posix/posix.cpp b/backends/platform/sdl/posix/posix.cpp
index fc68bf016b6..4577912ea74 100644
--- a/backends/platform/sdl/posix/posix.cpp
+++ b/backends/platform/sdl/posix/posix.cpp
@@ -235,6 +235,31 @@ Common::String OSystem_POSIX::getXdgUserDir(const char *name) {
 	return directoryPath;
 }
 
+Common::String OSystem_POSIX::getDefaultIconPath() {
+	Common::String iconsPath;
+
+	// On POSIX systems we follow the XDG Base Directory Specification for
+	// where to store files. The version we based our code upon can be found
+	// over here: https://specifications.freedesktop.org/basedir-spec/basedir-spec-0.8.html
+	const char *prefix = getenv("XDG_CACHE_HOME");
+	if (prefix == nullptr || !*prefix) {
+		prefix = getenv("HOME");
+		if (prefix == nullptr) {
+			return Common::String();
+		}
+
+		iconsPath = ".cache/";
+	}
+
+	iconsPath += "scummvm/icons";
+
+	if (!Posix::assureDirectoryExists(iconsPath, prefix)) {
+		return Common::String();
+	}
+
+	return iconsPath;
+}
+
 Common::String OSystem_POSIX::getScreenshotsPath() {
 	// If the user has configured a screenshots path, use it
 	const Common::String path = OSystem_SDL::getScreenshotsPath();
diff --git a/backends/platform/sdl/posix/posix.h b/backends/platform/sdl/posix/posix.h
index 3e8028e020e..2bf745873b8 100644
--- a/backends/platform/sdl/posix/posix.h
+++ b/backends/platform/sdl/posix/posix.h
@@ -35,6 +35,7 @@ public:
 
 	void addSysArchivesToSearchSet(Common::SearchSet &s, int priority = 0) override;
 
+	Common::String getDefaultIconPath() override;
 	Common::String getScreenshotsPath() override;
 
 protected:
diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp
index 3f1fd57d305..f87b89f6e88 100644
--- a/backends/platform/sdl/sdl.cpp
+++ b/backends/platform/sdl/sdl.cpp
@@ -302,6 +302,8 @@ void OSystem_SDL::initBackend() {
 	_presence = new DiscordPresence();
 #endif
 
+	ConfMan.registerDefault("iconspath", this->getDefaultIconPath());
+
 	_inited = true;
 
 	BaseBackend::initBackend();
@@ -760,6 +762,14 @@ Common::SaveFileManager *OSystem_SDL::getSavefileManager() {
 #endif
 }
 
+//Not specified in base class
+Common::String OSystem_SDL::getDefaultIconPath() {
+	Common::String path = ConfMan.get("iconspath");
+	if (!path.empty() && !path.hasSuffix("/"))
+		path += "/";
+	return path;
+}
+
 //Not specified in base class
 Common::String OSystem_SDL::getScreenshotsPath() {
 	Common::String path = ConfMan.get("screenshotpath");
diff --git a/backends/platform/sdl/sdl.h b/backends/platform/sdl/sdl.h
index 87c73522c5a..b4f52c3df49 100644
--- a/backends/platform/sdl/sdl.h
+++ b/backends/platform/sdl/sdl.h
@@ -90,7 +90,7 @@ public:
 	Common::TimerManager *getTimerManager() override;
 	Common::SaveFileManager *getSavefileManager() override;
 
-	//Screenshots
+	virtual Common::String getDefaultIconPath();
 	virtual Common::String getScreenshotsPath();
 
 #if defined(USE_OPENGL_GAME) || defined(USE_OPENGL_SHADERS)
diff --git a/gui/downloadiconsdialog.cpp b/gui/downloadiconsdialog.cpp
index 5c07714ed00..063f1da0445 100644
--- a/gui/downloadiconsdialog.cpp
+++ b/gui/downloadiconsdialog.cpp
@@ -369,7 +369,8 @@ void DownloadIconsDialog::setError(Common::U32String &msg) {
 }
 
 void DownloadIconsDialog::calculateList() {
-	if (!ConfMan.hasKey("iconspath")) {
+	Common::String iconsPath = ConfMan.get("iconspath");
+	if (iconsPath.empty()) {
 		Common::U32String str(_("ERROR: No icons path set"));
 		setError(str);
 		return;
@@ -377,7 +378,8 @@ void DownloadIconsDialog::calculateList() {
 
 	// Scan all files in iconspath and remove present ones from the
 	// donwloaded files list
-	Common::FSDirectory *iconDir = new Common::FSDirectory(ConfMan.get("iconspath"));
+	Common::FSDirectory *iconDir = new Common::FSDirectory(iconsPath);
+
 	Common::ArchiveMemberList iconFiles;
 
 	iconDir->listMatchingMembers(iconFiles, "gui-icons*.dat");
diff --git a/gui/gui-manager.cpp b/gui/gui-manager.cpp
index 0ed7abdfdb4..803051596d0 100644
--- a/gui/gui-manager.cpp
+++ b/gui/gui-manager.cpp
@@ -121,7 +121,7 @@ void GuiManager::initIconsSet() {
 
 	_iconsSet.clear();
 
-	if (ConfMan.hasKey("iconspath")) {
+	if (!ConfMan.get("iconspath").empty()) {
 		Common::FSDirectory *iconDir = new Common::FSDirectory(ConfMan.get("iconspath"));
 		Common::ArchiveMemberList iconFiles;
 
diff --git a/gui/options.cpp b/gui/options.cpp
index ea04dc29985..51a1b8a315d 100644
--- a/gui/options.cpp
+++ b/gui/options.cpp
@@ -2216,7 +2216,7 @@ void GlobalOptionsDialog::build() {
 
 	setPath(_savePath, "savepath", _("Default")); 
 	setPath(_themePath, "themepath", _c("None", "path"));
-	setPath(_iconPath, "iconspath", _c("None", "path"));
+	setPath(_iconPath, "iconspath", _("Default"));
 	setPath(_extraPath, "extrapath", _c("None", "path"));
 
 #ifdef DYNAMIC_MODULES
@@ -2304,7 +2304,7 @@ void GlobalOptionsDialog::addPathsControls(GuiObject *boss, const Common::String
 		new ButtonWidget(boss, prefix + "IconButton", _("Icon Path:"), Common::U32String(), kChooseIconDirCmd);
 	else
 		new ButtonWidget(boss, prefix + "IconButton", _c("Icon Path:", "lowres"), Common::U32String(), kChooseIconDirCmd);
-	_iconPath = new StaticTextWidget(boss, prefix + "IconPath", _c("None", "path"));
+	_iconPath = new StaticTextWidget(boss, prefix + "IconPath", _c("Default", "path"));
 
 	_iconPathClearButton = addClearButton(boss, prefix + "IconPathClearButton", kIconPathClearCmd);
 
@@ -2709,7 +2709,7 @@ void GlobalOptionsDialog::apply() {
 
 	changePath(_savePath, "savepath", _("Default")); 
 	changePath(_themePath, "themepath", _c("None", "path")); 
-	changePath(_iconPath, "iconspath", _c("None", "path")); 
+	changePath(_iconPath, "iconspath", _("Default"));
 	changePath(_extraPath, "extrapath", _c("None", "path")); 
 
 #ifdef DYNAMIC_MODULES
@@ -3001,7 +3001,7 @@ void GlobalOptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint3
 		_themePath->setLabel(_c("None", "path"));
 		break;
 	case kIconPathClearCmd:
-		_iconPath->setLabel(_c("None", "path"));
+		_iconPath->setLabel(_("Default"));
 		break;
 	case kExtraPathClearCmd:
 		_extraPath->setLabel(_c("None", "path"));


Commit: b5fac9671d63f35d9dbe8fba583762557eb49188
    https://github.com/scummvm/scummvm/commit/b5fac9671d63f35d9dbe8fba583762557eb49188
Author: Thunderforge (wjherrmann at gmail.com)
Date: 2022-07-02T22:34:36+02:00

Commit Message:
COMMON: Add getDefaultIconPath() for Windows

Changed paths:
    backends/platform/sdl/win32/win32.cpp
    backends/platform/sdl/win32/win32.h


diff --git a/backends/platform/sdl/win32/win32.cpp b/backends/platform/sdl/win32/win32.cpp
index 19bbcaaf3e5..e5570a004b3 100644
--- a/backends/platform/sdl/win32/win32.cpp
+++ b/backends/platform/sdl/win32/win32.cpp
@@ -253,6 +253,23 @@ Common::String OSystem_Win32::getSystemLanguage() const {
 	return OSystem_SDL::getSystemLanguage();
 }
 
+Common::String OSystem_Win32::getDefaultIconPath() {
+	TCHAR iconsPath[MAX_PATH];
+
+	if (_isPortable) {
+		Win32::getProcessDirectory(iconsPath, MAX_PATH);
+	} else {
+		// Use the Application Data directory of the user profile
+		if (!Win32::getApplicationDataDirectory(iconsPath)) {
+			return Common::String();
+		}
+		_tcscat(iconsPath, TEXT("\\ScummVM\\Icons"));
+		CreateDirectory(iconsPath, nullptr);
+	}
+
+	return Win32::tcharToString(iconsPath);
+}
+
 Common::String OSystem_Win32::getScreenshotsPath() {
 	// If the user has configured a screenshots path, use it
 	Common::String screenshotsPath = ConfMan.get("screenshotpath");
diff --git a/backends/platform/sdl/win32/win32.h b/backends/platform/sdl/win32/win32.h
index 2991f00cc5e..87f8fd4baf9 100644
--- a/backends/platform/sdl/win32/win32.h
+++ b/backends/platform/sdl/win32/win32.h
@@ -48,6 +48,7 @@ public:
 
 	Common::String getSystemLanguage() const override;
 
+	Common::String getDefaultIconPath() override;
 	Common::String getScreenshotsPath() override;
 
 protected:


Commit: 9afd41b1952e996608f9c074cdf139bfdddbfdc3
    https://github.com/scummvm/scummvm/commit/9afd41b1952e996608f9c074cdf139bfdddbfdc3
Author: Thunderforge (wjherrmann at gmail.com)
Date: 2022-07-02T22:34:36+02:00

Commit Message:
COMMON: Renaming getDefaultIconPath() -> getDefaultIconsPath()

Changed paths:
    backends/platform/sdl/macosx/macosx.cpp
    backends/platform/sdl/macosx/macosx.h
    backends/platform/sdl/posix/posix.cpp
    backends/platform/sdl/posix/posix.h
    backends/platform/sdl/sdl.cpp
    backends/platform/sdl/sdl.h
    backends/platform/sdl/win32/win32.cpp
    backends/platform/sdl/win32/win32.h


diff --git a/backends/platform/sdl/macosx/macosx.cpp b/backends/platform/sdl/macosx/macosx.cpp
index 1c3ef7349f8..3520f93e203 100644
--- a/backends/platform/sdl/macosx/macosx.cpp
+++ b/backends/platform/sdl/macosx/macosx.cpp
@@ -261,7 +261,7 @@ Common::String OSystem_MacOSX::getDefaultLogFileName() {
 	return Common::String(prefix) + "/Library/Logs/scummvm.log";
 }
 
-Common::String OSystem_MacOSX::getDefaultIconPath() {
+Common::String OSystem_MacOSX::getDefaultIconsPath() {
 	const char *prefix = getenv("HOME");
 	if (prefix == nullptr) {
 		return Common::String();
diff --git a/backends/platform/sdl/macosx/macosx.h b/backends/platform/sdl/macosx/macosx.h
index 39b5be253da..6bbdd0f5564 100644
--- a/backends/platform/sdl/macosx/macosx.h
+++ b/backends/platform/sdl/macosx/macosx.h
@@ -48,7 +48,7 @@ public:
 	GraphicsManagerType getDefaultGraphicsManager() const override;
 #endif
 
-	Common::String getDefaultIconPath() override;
+	Common::String getDefaultIconsPath() override;
 	Common::String getScreenshotsPath() override;
 
 protected:
diff --git a/backends/platform/sdl/posix/posix.cpp b/backends/platform/sdl/posix/posix.cpp
index 4577912ea74..0e1cb21230e 100644
--- a/backends/platform/sdl/posix/posix.cpp
+++ b/backends/platform/sdl/posix/posix.cpp
@@ -235,7 +235,7 @@ Common::String OSystem_POSIX::getXdgUserDir(const char *name) {
 	return directoryPath;
 }
 
-Common::String OSystem_POSIX::getDefaultIconPath() {
+Common::String OSystem_POSIX::getDefaultIconsPath() {
 	Common::String iconsPath;
 
 	// On POSIX systems we follow the XDG Base Directory Specification for
diff --git a/backends/platform/sdl/posix/posix.h b/backends/platform/sdl/posix/posix.h
index 2bf745873b8..cc3ca5777da 100644
--- a/backends/platform/sdl/posix/posix.h
+++ b/backends/platform/sdl/posix/posix.h
@@ -35,7 +35,7 @@ public:
 
 	void addSysArchivesToSearchSet(Common::SearchSet &s, int priority = 0) override;
 
-	Common::String getDefaultIconPath() override;
+	Common::String getDefaultIconsPath() override;
 	Common::String getScreenshotsPath() override;
 
 protected:
diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp
index f87b89f6e88..c11f08de12a 100644
--- a/backends/platform/sdl/sdl.cpp
+++ b/backends/platform/sdl/sdl.cpp
@@ -302,7 +302,7 @@ void OSystem_SDL::initBackend() {
 	_presence = new DiscordPresence();
 #endif
 
-	ConfMan.registerDefault("iconspath", this->getDefaultIconPath());
+	ConfMan.registerDefault("iconspath", this->getDefaultIconsPath());
 
 	_inited = true;
 
@@ -763,7 +763,7 @@ Common::SaveFileManager *OSystem_SDL::getSavefileManager() {
 }
 
 //Not specified in base class
-Common::String OSystem_SDL::getDefaultIconPath() {
+Common::String OSystem_SDL::getDefaultIconsPath() {
 	Common::String path = ConfMan.get("iconspath");
 	if (!path.empty() && !path.hasSuffix("/"))
 		path += "/";
diff --git a/backends/platform/sdl/sdl.h b/backends/platform/sdl/sdl.h
index b4f52c3df49..435e421f452 100644
--- a/backends/platform/sdl/sdl.h
+++ b/backends/platform/sdl/sdl.h
@@ -90,7 +90,7 @@ public:
 	Common::TimerManager *getTimerManager() override;
 	Common::SaveFileManager *getSavefileManager() override;
 
-	virtual Common::String getDefaultIconPath();
+	virtual Common::String getDefaultIconsPath();
 	virtual Common::String getScreenshotsPath();
 
 #if defined(USE_OPENGL_GAME) || defined(USE_OPENGL_SHADERS)
diff --git a/backends/platform/sdl/win32/win32.cpp b/backends/platform/sdl/win32/win32.cpp
index e5570a004b3..b1d524002ed 100644
--- a/backends/platform/sdl/win32/win32.cpp
+++ b/backends/platform/sdl/win32/win32.cpp
@@ -253,7 +253,7 @@ Common::String OSystem_Win32::getSystemLanguage() const {
 	return OSystem_SDL::getSystemLanguage();
 }
 
-Common::String OSystem_Win32::getDefaultIconPath() {
+Common::String OSystem_Win32::getDefaultIconsPath() {
 	TCHAR iconsPath[MAX_PATH];
 
 	if (_isPortable) {
diff --git a/backends/platform/sdl/win32/win32.h b/backends/platform/sdl/win32/win32.h
index 87f8fd4baf9..d60281efa5a 100644
--- a/backends/platform/sdl/win32/win32.h
+++ b/backends/platform/sdl/win32/win32.h
@@ -48,7 +48,7 @@ public:
 
 	Common::String getSystemLanguage() const override;
 
-	Common::String getDefaultIconPath() override;
+	Common::String getDefaultIconsPath() override;
 	Common::String getScreenshotsPath() override;
 
 protected:


Commit: 33389f062e6c7965d129a569d9587cbf77325472
    https://github.com/scummvm/scummvm/commit/33389f062e6c7965d129a569d9587cbf77325472
Author: Thunderforge (wjherrmann at gmail.com)
Date: 2022-07-02T22:34:36+02:00

Commit Message:
COMMON: Adding comment for default path methods

Changed paths:
    backends/platform/sdl/macosx/macosx.h
    backends/platform/sdl/posix/posix.h
    backends/platform/sdl/sdl.h
    backends/platform/sdl/win32/win32.h


diff --git a/backends/platform/sdl/macosx/macosx.h b/backends/platform/sdl/macosx/macosx.h
index 6bbdd0f5564..0edd35e869a 100644
--- a/backends/platform/sdl/macosx/macosx.h
+++ b/backends/platform/sdl/macosx/macosx.h
@@ -48,6 +48,7 @@ public:
 	GraphicsManagerType getDefaultGraphicsManager() const override;
 #endif
 
+	// Default paths
 	Common::String getDefaultIconsPath() override;
 	Common::String getScreenshotsPath() override;
 
diff --git a/backends/platform/sdl/posix/posix.h b/backends/platform/sdl/posix/posix.h
index cc3ca5777da..5623a8c84d6 100644
--- a/backends/platform/sdl/posix/posix.h
+++ b/backends/platform/sdl/posix/posix.h
@@ -35,6 +35,7 @@ public:
 
 	void addSysArchivesToSearchSet(Common::SearchSet &s, int priority = 0) override;
 
+	// Default paths
 	Common::String getDefaultIconsPath() override;
 	Common::String getScreenshotsPath() override;
 
diff --git a/backends/platform/sdl/sdl.h b/backends/platform/sdl/sdl.h
index 435e421f452..263f82e5578 100644
--- a/backends/platform/sdl/sdl.h
+++ b/backends/platform/sdl/sdl.h
@@ -90,6 +90,7 @@ public:
 	Common::TimerManager *getTimerManager() override;
 	Common::SaveFileManager *getSavefileManager() override;
 
+	// Default paths
 	virtual Common::String getDefaultIconsPath();
 	virtual Common::String getScreenshotsPath();
 
diff --git a/backends/platform/sdl/win32/win32.h b/backends/platform/sdl/win32/win32.h
index d60281efa5a..c39f4d7b9ea 100644
--- a/backends/platform/sdl/win32/win32.h
+++ b/backends/platform/sdl/win32/win32.h
@@ -48,6 +48,7 @@ public:
 
 	Common::String getSystemLanguage() const override;
 
+	// Default paths
 	Common::String getDefaultIconsPath() override;
 	Common::String getScreenshotsPath() override;
 


Commit: 1cb41b667f9b72fb58ba232f9cfff9909fb62397
    https://github.com/scummvm/scummvm/commit/1cb41b667f9b72fb58ba232f9cfff9909fb62397
Author: Thunderforge (wjherrmann at gmail.com)
Date: 2022-07-02T22:34:36+02:00

Commit Message:
COMMON: Putting Icons in a subdirectory if in Win32 portable mode

Changed paths:
    backends/platform/sdl/win32/win32.cpp


diff --git a/backends/platform/sdl/win32/win32.cpp b/backends/platform/sdl/win32/win32.cpp
index b1d524002ed..a03f9b4f9b5 100644
--- a/backends/platform/sdl/win32/win32.cpp
+++ b/backends/platform/sdl/win32/win32.cpp
@@ -258,6 +258,7 @@ Common::String OSystem_Win32::getDefaultIconsPath() {
 
 	if (_isPortable) {
 		Win32::getProcessDirectory(iconsPath, MAX_PATH);
+		_tcscat(iconsPath, TEXT("\\Icons\\"));
 	} else {
 		// Use the Application Data directory of the user profile
 		if (!Win32::getApplicationDataDirectory(iconsPath)) {


Commit: 5ee9618c158f821075315b72d9ebdca7ab801784
    https://github.com/scummvm/scummvm/commit/5ee9618c158f821075315b72d9ebdca7ab801784
Author: Thunderforge (wjherrmann at gmail.com)
Date: 2022-07-02T22:34:36+02:00

Commit Message:
COMMON: Adding prefix to POSIX icon path

Co-authored-by: Le Philousophe <lephilousophe at users.noreply.github.com>

Changed paths:
    backends/platform/sdl/posix/posix.cpp


diff --git a/backends/platform/sdl/posix/posix.cpp b/backends/platform/sdl/posix/posix.cpp
index 0e1cb21230e..522e0714190 100644
--- a/backends/platform/sdl/posix/posix.cpp
+++ b/backends/platform/sdl/posix/posix.cpp
@@ -257,7 +257,7 @@ Common::String OSystem_POSIX::getDefaultIconsPath() {
 		return Common::String();
 	}
 
-	return iconsPath;
+	return Common::String::format("%s/%s", prefix, iconsPath.c_str());
 }
 
 Common::String OSystem_POSIX::getScreenshotsPath() {


Commit: 3e1d4ae9cef6d8681204cab4e4f89d05aa8f6ecc
    https://github.com/scummvm/scummvm/commit/3e1d4ae9cef6d8681204cab4e4f89d05aa8f6ecc
Author: Thunderforge (wjherrmann at gmail.com)
Date: 2022-07-02T22:34:36+02:00

Commit Message:
COMMON: Restructuring how ApplicationSupport path is calculated and putting in Icons subdirectory

Changed paths:
    backends/platform/sdl/macosx/macosx.cpp
    backends/platform/sdl/macosx/macosx_wrapper.h
    backends/platform/sdl/macosx/macosx_wrapper.mm


diff --git a/backends/platform/sdl/macosx/macosx.cpp b/backends/platform/sdl/macosx/macosx.cpp
index 3520f93e203..b422722a296 100644
--- a/backends/platform/sdl/macosx/macosx.cpp
+++ b/backends/platform/sdl/macosx/macosx.cpp
@@ -262,18 +262,13 @@ Common::String OSystem_MacOSX::getDefaultLogFileName() {
 }
 
 Common::String OSystem_MacOSX::getDefaultIconsPath() {
-	const char *prefix = getenv("HOME");
-	if (prefix == nullptr) {
-		return Common::String();
-	}
-
-	const Common::String appSupportFolder = Common::String(prefix) + "/Library/Application Support/ScummVM";
+	const Common::String defaultIconsPath = getAppSupportPathMacOSX() + "/Icons";
 
-	if (!Posix::assureDirectoryExists(appSupportFolder)) {
+	if (!Posix::assureDirectoryExists(defaultIconsPath)) {
 		return Common::String();
 	}
 
-	return appSupportFolder;
+	return defaultIconsPath;
 }
 
 Common::String OSystem_MacOSX::getScreenshotsPath() {
diff --git a/backends/platform/sdl/macosx/macosx_wrapper.h b/backends/platform/sdl/macosx/macosx_wrapper.h
index 0af5ac09d9d..b454ff5d52c 100644
--- a/backends/platform/sdl/macosx/macosx_wrapper.h
+++ b/backends/platform/sdl/macosx/macosx_wrapper.h
@@ -30,5 +30,6 @@ Common::U32String getTextFromClipboardMacOSX();
 bool setTextInClipboardMacOSX(const Common::U32String &text);
 Common::String getDesktopPathMacOSX();
 Common::String getResourceAppBundlePathMacOSX();
+Common::String getAppSupportPathMacOSX();
 
 #endif
diff --git a/backends/platform/sdl/macosx/macosx_wrapper.mm b/backends/platform/sdl/macosx/macosx_wrapper.mm
index 0e4b7e903d0..68034e2a2ef 100644
--- a/backends/platform/sdl/macosx/macosx_wrapper.mm
+++ b/backends/platform/sdl/macosx/macosx_wrapper.mm
@@ -118,3 +118,14 @@ Common::String getResourceAppBundlePathMacOSX() {
 		return Common::String();
 	return Common::String([bundlePath fileSystemRepresentation]);
 }
+
+Common::String getAppSupportPathMacOSX() {
+	// See comments in getDesktopPathMacOSX() as we use the same methods
+	NSArray *paths = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES);
+	if ([paths count] == 0)
+		return Common::String();
+	NSString *path = [paths objectAtIndex:0];
+	if (path == nil)
+		return Common::String();
+	return Common::String([path fileSystemRepresentation]) + "/ScummVM";
+}
\ No newline at end of file


Commit: 3ffbb3b030db317407c4ca91578aa19cc6d1fe18
    https://github.com/scummvm/scummvm/commit/3ffbb3b030db317407c4ca91578aa19cc6d1fe18
Author: Thunderforge (wjherrmann at gmail.com)
Date: 2022-07-02T22:34:36+02:00

Commit Message:
COMMON: Adding endline to macosx_wrapper.mm

Changed paths:
    backends/platform/sdl/macosx/macosx_wrapper.mm


diff --git a/backends/platform/sdl/macosx/macosx_wrapper.mm b/backends/platform/sdl/macosx/macosx_wrapper.mm
index 68034e2a2ef..a98a6c0684b 100644
--- a/backends/platform/sdl/macosx/macosx_wrapper.mm
+++ b/backends/platform/sdl/macosx/macosx_wrapper.mm
@@ -128,4 +128,4 @@ Common::String getAppSupportPathMacOSX() {
 	if (path == nil)
 		return Common::String();
 	return Common::String([path fileSystemRepresentation]) + "/ScummVM";
-}
\ No newline at end of file
+}




More information about the Scummvm-git-logs mailing list