aboutsummaryrefslogtreecommitdiffstats
path: root/Game/Code/Classes
diff options
context:
space:
mode:
authork-m_schindler <k-m_schindler@b956fd51-792f-4845-bead-9b4dfca2ff2c>2008-07-15 23:46:10 +0000
committerk-m_schindler <k-m_schindler@b956fd51-792f-4845-bead-9b4dfca2ff2c>2008-07-15 23:46:10 +0000
commit4dd9427bd27321e5ac8e9bff9a677f527294ac97 (patch)
tree228bf0f35d7e4e86e37477e14bf9d579010bb461 /Game/Code/Classes
parent17298eb642931ea1eeeb733104a9e0f0432eb04d (diff)
downloadusdx-4dd9427bd27321e5ac8e9bff9a677f527294ac97.tar.gz
usdx-4dd9427bd27321e5ac8e9bff9a677f527294ac97.tar.xz
usdx-4dd9427bd27321e5ac8e9bff9a677f527294ac97.zip
New place for the Resources for Mac OS X: $HOME/Appliations Support/UltraStarDeluxe/Resources
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1201 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to 'Game/Code/Classes')
-rw-r--r--Game/Code/Classes/UMain.pas6
-rw-r--r--Game/Code/Classes/UPlatformMacOSX.pas60
2 files changed, 51 insertions, 15 deletions
diff --git a/Game/Code/Classes/UMain.pas b/Game/Code/Classes/UMain.pas
index d9440144..a0bdbb94 100644
--- a/Game/Code/Classes/UMain.pas
+++ b/Game/Code/Classes/UMain.pas
@@ -20,6 +20,9 @@ uses
ULyrics,
UScreenSing,
USong,
+{$IFDEF DARWIN}
+ UMacResources,
+{$ENDIF}
gl;
type
@@ -149,6 +152,9 @@ procedure Main;
var
WndTitle: string;
begin
+{$IFDEF DARWIN}
+ UMacResources.init;
+{$ENDIF}
try
WndTitle := USDXVersionStr;
diff --git a/Game/Code/Classes/UPlatformMacOSX.pas b/Game/Code/Classes/UPlatformMacOSX.pas
index f12f5254..b6ced926 100644
--- a/Game/Code/Classes/UPlatformMacOSX.pas
+++ b/Game/Code/Classes/UPlatformMacOSX.pas
@@ -1,17 +1,40 @@
unit UPlatformMacOSX;
-// Note on directories (by eddie):
-// We use subfolders of the application directory on tha mac, because:
-// 1. Installation on the mac works as follows: Extract and copy an application
-// and if you don't like or need the application anymore you move the folder
-// to the trash - and you're done.
-// 2. If we would use subfolders of the home directory we would have to spread our
-// files to many directories - these directories are defined by Apple, but the
-// average user doesn't know them, beacuse he or she doesn't need to know them.
-// But for UltraStar the user must at least know the songs directory...
-//
-// Creating a subfolder directly under the home directory is not acceptable.
-//
+{
+ Note on directories (by eddie):
+ We use subfolders of the application directory on tha mac, because:
+ 1. Installation on the mac works as follows: Extract and copy an application
+ and if you don't like or need the application anymore you move the folder
+ to the trash - and you're done.
+ 2. If we would use subfolders of the home directory we would have to spread our
+ files to many directories - these directories are defined by Apple, but the
+ average user doesn't know them, beacuse he or she doesn't need to know them.
+ But for UltraStar the user must at least know the songs directory...
+
+ Creating a subfolder directly under the home directory is not acceptable.
+
+ More on this from KMS aka mischi
+
+ Handling of resources and folders should follow these lines.
+
+ Acceptable places for files are folders named UltraStarDeluxe either in
+ /Library/Application Support/
+ or
+ ~/Library/Application Support/
+
+ Then
+ GetGameSharedPath could return
+ /Library/Application Support/UltraStarDeluxe/Resources/
+ GetGameUserPath could return
+ ~/Library/Application Support/UltraStarDeluxe/Resources/
+
+ USDX checks, whether GetGameUserPath exists. If not, USDX creates its.
+ The existance of needed files is then checked and if a file is missing
+ it is copied to there from within the Resources folder in the Application
+ bundle, which contains the default files. USDX should not delete files or
+ folders in Application Support/UltraStarDeluxe automatically or without
+ user confirmation.
+}
interface
@@ -59,22 +82,29 @@ begin
end;
end;
+function GetApplicationSupportPath : WideString;
+const
+ PathName : string = '/Library/Application Support/UltraStarDeluxe/Resources';
+begin
+ Result := GetEnvironmentVariable('HOME') + PathName + '/';
+end;
+
function TPlatformMacOSX.GetLogPath : WideString;
begin
// eddie: Please read the note at the top of this file, why we use the application directory and not the user directory.
- Result := GetBundlePath + 'Contents/Resources/Logs';
+ Result := GetApplicationSupportPath + 'Logs';
end;
function TPlatformMacOSX.GetGameSharedPath : WideString;
begin
// eddie: Please read the note at the top of this file, why we use the application directory and not the user directory.
- Result := GetBundlePath + 'Contents/Resources/';
+ Result := GetApplicationSupportPath;
end;
function TPlatformMacOSX.GetGameUserPath : WideString;
begin
// eddie: Please read the note at the top of this file, why we use the application directory and not the user directory.
- Result := GetBundlePath + 'Contents/Resources/';
+ Result := GetApplicationSupportPath;
end;
function TPlatformMacOSX.DirectoryFindFiles(Dir, Filter : WideString; ReturnAllSubDirs : boolean) : TDirectoryEntryArray;