aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoreddie-0815 <eddie-0815@b956fd51-792f-4845-bead-9b4dfca2ff2c>2008-01-20 16:27:17 +0000
committereddie-0815 <eddie-0815@b956fd51-792f-4845-bead-9b4dfca2ff2c>2008-01-20 16:27:17 +0000
commitfc31e84fe89000bee337983d933539794c7552fd (patch)
tree80fe9ddc2cd3842359ea8af3dcd66458d6ce0a59
parent5717a98e5cade730eabe7ee06daf3f5afc7dd190 (diff)
downloadusdx-fc31e84fe89000bee337983d933539794c7552fd.tar.gz
usdx-fc31e84fe89000bee337983d933539794c7552fd.tar.xz
usdx-fc31e84fe89000bee337983d933539794c7552fd.zip
Fixed compilation on the mac. At the moment the project doesn't link on the mac.
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@798 b956fd51-792f-4845-bead-9b4dfca2ff2c
-rw-r--r--Game/Code/Classes/UPlatformMacOSX.pas48
1 files changed, 35 insertions, 13 deletions
diff --git a/Game/Code/Classes/UPlatformMacOSX.pas b/Game/Code/Classes/UPlatformMacOSX.pas
index 30a2ab47..7b081607 100644
--- a/Game/Code/Classes/UPlatformMacOSX.pas
+++ b/Game/Code/Classes/UPlatformMacOSX.pas
@@ -1,5 +1,18 @@
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.
+//
+
interface
{$IFDEF FPC}
@@ -13,15 +26,14 @@ uses Classes, UPlatform;
type
TPlatformMacOSX = class( TInterfacedObject, IPlatform)
- private
public
- Function DirectoryFindFiles(Dir, Filter : WideString; ReturnAllSubDirs : Boolean) : TDirectoryEntryArray; override;
- function GetGamePath: WideString; override;
+ Function DirectoryFindFiles(Dir, Filter : WideString; ReturnAllSubDirs : Boolean) : TDirectoryEntryArray;
function TerminateIfAlreadyRunning(var WndTitle : String) : Boolean;
procedure halt();
- function GetLogPath : WideString; override;
- function GetGameSharedPath : WideString; override;
- function GetGameUserPath : WideString; override;
+ function GetLogPath : WideString;
+ function GetGameSharedPath : WideString;
+ function GetGameUserPath : WideString;
+ function FindSongFile(Dir, Mask: widestring): widestring;
end;
implementation
@@ -48,19 +60,19 @@ end;
function TPlatformMacOSX.GetLogPath : WideString;
begin
- // surly logs go in /var/log/ ???
- Result := GetBundlePath;
+ // eddie: Please read the note at the top of this file, why we use the application directory and not the user directory.
+ Result := GetBundlePath + '/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;
end;
function TPlatformMacOSX.GetGameUserPath : WideString;
begin
- // is there no user profile ???
- // like ... /home/user/ that could be used for song locations etc ??
+ // eddie: Please read the note at the top of this file, why we use the application directory and not the user directory.
Result := GetBundlePath;
end;
@@ -69,8 +81,6 @@ var
i : Integer;
TheDir : pdir;
ADirent : pDirent;
- Entry : Longint;
- info : stat;
lAttrib : integer;
begin
i := 0;
@@ -108,7 +118,7 @@ end;
function TPlatformMacOSX.TerminateIfAlreadyRunning(var WndTitle : String) : Boolean;
begin
- result := false;
+ result := false;
end;
@@ -117,4 +127,16 @@ begin
halt;
end;
+function TPlatformMacOSX.FindSongFile(Dir, Mask: widestring): widestring;
+var
+ SR: TSearchRec; // for parsing song directory
+begin
+ Result := '';
+ if SysUtils.FindFirst(Dir + Mask, faDirectory, SR) = 0 then begin
+ Result := SR.Name;
+ end; // if
+ SysUtils.FindClose(SR);
+end;
+
+
end.