File tree Expand file tree Collapse file tree 10 files changed +36
-14
lines changed Expand file tree Collapse file tree 10 files changed +36
-14
lines changed Original file line number Diff line number Diff line change @@ -117,6 +117,20 @@ void OSystem_MacOSX::initBackend() {
117
117
_textToSpeechManager = new MacOSXTextToSpeechManager ();
118
118
#endif
119
119
120
+ // Migrate savepath.
121
+ // It used to be in ~/Documents/ScummVM Savegames/, but was changed to use the application support
122
+ // directory. To migrate old config files we use a flag to indicate if the config file was migrated.
123
+ // This allows detecting old config files. If the flag is not set we:
124
+ // 1. Set the flag
125
+ // 2. If the config file has no custom savepath and has some games, we set the savepath to the old default.
126
+ if (!ConfMan.hasKey (" macos_savepath_migrated" , Common::ConfigManager::kApplicationDomain )) {
127
+ if (!ConfMan.hasKey (" savepath" , Common::ConfigManager::kApplicationDomain ) && !ConfMan.getGameDomains ().empty ()) {
128
+ ConfMan.set (" savepath" , getDocumentsPathMacOSX () + " /ScummVM Savegames" , Common::ConfigManager::kApplicationDomain );
129
+ }
130
+ ConfMan.setBool (" macos_savepath_migrated" , true , Common::ConfigManager::kApplicationDomain );
131
+ ConfMan.flushToDisk ();
132
+ }
133
+
120
134
// Invoke parent implementation of this method
121
135
OSystem_POSIX::initBackend ();
122
136
}
Original file line number Diff line number Diff line change 25
25
#include <common/str.h>
26
26
27
27
Common ::String getDesktopPathMacOSX ();
28
+ Common ::String getDocumentsPathMacOSX ();
28
29
Common ::String getResourceAppBundlePathMacOSX ();
29
30
Common ::String getAppSupportPathMacOSX ();
30
31
Common ::String getMacBundleName ();
Original file line number Diff line number Diff line change 46
46
return Common::String ([path fileSystemRepresentation ]);
47
47
}
48
48
49
+ Common::String getDocumentsPathMacOSX () {
50
+ // See comment in getDesktopPathMacOSX()
51
+ NSArray *paths = NSSearchPathForDirectoriesInDomains (NSDocumentDirectory, NSUserDomainMask, YES );
52
+ if ([paths count ] == 0 )
53
+ return Common::String ();
54
+ NSString *path = [paths objectAtIndex: 0 ];
55
+ if (path == nil )
56
+ return Common::String ();
57
+ return Common::String ([path fileSystemRepresentation ]);
58
+ }
59
+
49
60
Common::String getResourceAppBundlePathMacOSX () {
50
61
NSString *bundlePath = [[NSBundle mainBundle ] resourcePath ];
51
62
if (bundlePath == nil )
Original file line number Diff line number Diff line change 32
32
33
33
#include " backends/saves/posix/posix-saves.h"
34
34
#include " backends/fs/posix/posix-fs.h"
35
+ #if defined(MACOSX)
36
+ #include " backends/platform/sdl/macosx/macosx_wrapper.h"
37
+ #endif
35
38
36
39
#include " common/config-manager.h"
37
40
#include " common/savefile.h"
@@ -44,14 +47,11 @@ POSIXSaveFileManager::POSIXSaveFileManager() {
44
47
Common::Path savePath;
45
48
46
49
#if defined(MACOSX)
47
- const char *home = getenv (" HOME" );
48
- if (home && *home && strlen (home) < MAXPATHLEN) {
49
- savePath = home;
50
- savePath.joinInPlace (" Documents/ScummVM Savegames" );
51
-
50
+ savePath = getAppSupportPathMacOSX ();
51
+ if (!savePath.empty ()) {
52
+ savePath.joinInPlace (" Savegames" );
52
53
ConfMan.registerDefault (" savepath" , savePath);
53
54
}
54
-
55
55
#else
56
56
const char *envVar;
57
57
Original file line number Diff line number Diff line change 78
78
<string >scummvm.docktileplugin </string >
79
79
<key >NSRequiresAquaSystemAppearance </key >
80
80
<false />
81
- <key >NSDocumentsFolderUsageDescription </key >
82
- <string >ScummVM saves and loads savegames in the Documents folder by default. </string >
83
81
<key >SUPublicDSAKeyFile </key >
84
82
<string >dsa_pub.pem </string >
85
83
<key >NSHighResolutionCapable </key >
Original file line number Diff line number Diff line change 78
78
<string >scummvm.docktileplugin</string >
79
79
<key >NSRequiresAquaSystemAppearance</key >
80
80
<false />
81
- <key >NSDocumentsFolderUsageDescription</key >
82
- <string >ScummVM saves and loads savegames in the Documents folder by default.</string >
83
81
<key >SUPublicDSAKeyFile</key >
84
82
<string >dsa_pub.pem</string >
85
83
<key >NSHighResolutionCapable</key >
Original file line number Diff line number Diff line change @@ -1352,7 +1352,7 @@ Uložené hry jsou na některých platformách standardně umístěny do součas
1352
1352
1353
1353
Platformy, které v současnosti mají jiné výchozí složky jsou:
1354
1354
macOS:
1355
- $HOME/Documents/ScummVM Savegames/
1355
+ $HOME/Library/Application Support/ScummVM/ Savegames/
1356
1356
1357
1357
Jiné unixy:
1358
1358
Řídíme se specifikacemi základního adresáře XDG. To znamená, že nastavení lze nalézt v:
Original file line number Diff line number Diff line change @@ -2017,7 +2017,7 @@ Sehen Sie sich das Beispiel weiter unten in dieser Liesmich-Datei an.
2017
2017
2018
2018
Die folgenden Plattformen haben ein anderes Standard-Verzeichnis:
2019
2019
macOS:
2020
- $HOME/Documents/ScummVM Savegames/
2020
+ $HOME/Library/Application Support/ScummVM/ Savegames/
2021
2021
2022
2022
Andere UNIX-Systeme:
2023
2023
Wir befolgen die Spezifikation XDG Base Directory. Dies bedeutet, dass
Original file line number Diff line number Diff line change @@ -60,7 +60,7 @@ Default saved game paths are shown below.
60
60
61
61
.. tab-item :: macOS
62
62
63
- ``~/Documents/ScummVM Savegames/ ``
63
+ ``~/Library/Application Support/ScummVM/Savegames/ `` (with versions of ScummVM prior to 2.9 it was in `` ~/ Documents/ScummVM Savegames/ ``).
64
64
65
65
66
66
.. tab-item :: Linux/Unix
Original file line number Diff line number Diff line change @@ -1031,7 +1031,7 @@ Spardata lagras som standard i den aktiva katalogen på vissa plattformar och i
1031
1031
1032
1032
Plattformar som för närvarande har annorlunda standardkataloger:
1033
1033
macOS:
1034
- $HOME/Documents/ScummVM Savegames/
1034
+ $HOME/Library/Application Support/ScummVM/ Savegames/
1035
1035
1036
1036
Övriga unix-system:
1037
1037
$HOME/.scummvm/
You can’t perform that action at this time.
0 commit comments