From 329e2b8eabd0f4ecb6e6a9bdc66d595c988d399a Mon Sep 17 00:00:00 2001 From: tobigun Date: Thu, 17 Jul 2008 16:46:58 +0000 Subject: - UPlatformXYZ.pas clean-up - TPlatform now implements common behaviour - added TPlatform.Init() git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1207 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UPlatformLinux.pas | 54 ++++++++---------------------------- 1 file changed, 11 insertions(+), 43 deletions(-) (limited to 'Game/Code/Classes/UPlatformLinux.pas') diff --git a/Game/Code/Classes/UPlatformLinux.pas b/Game/Code/Classes/UPlatformLinux.pas index f9b83f2c..7e9cac23 100644 --- a/Game/Code/Classes/UPlatformLinux.pas +++ b/Game/Code/Classes/UPlatformLinux.pas @@ -14,20 +14,15 @@ uses UConfig; type - - TPlatformLinux = class(TInterfacedObject, IPlatform) + TPlatformLinux = class(TPlatform) private function GetHomeDir(): string; public - function DirectoryFindFiles(Dir, Filter : WideString; ReturnAllSubDirs : Boolean) : TDirectoryEntryArray; - function TerminateIfAlreadyRunning(var WndTitle : String) : Boolean; - function FindSongFile(Dir, Mask: widestring): widestring; - - procedure Halt; + function DirectoryFindFiles(Dir, Filter: WideString; ReturnAllSubDirs: Boolean): TDirectoryEntryArray; override; - function GetLogPath : WideString; - function GetGameSharedPath : WideString; - function GetGameUserPath : WideString; + function GetLogPath : WideString; override; + function GetGameSharedPath : WideString; override; + function GetGameUserPath : WideString; override; end; implementation @@ -41,9 +36,9 @@ uses SysUtils, ULog; -function TPlatformLinux.DirectoryFindFiles(Dir, Filter : WideString; ReturnAllSubDirs : Boolean) : TDirectoryEntryArray; +function TPlatformLinux.DirectoryFindFiles(Dir, Filter: WideString; ReturnAllSubDirs: Boolean): TDirectoryEntryArray; var - i : Integer; + i: Integer; TheDir : pDir; ADirent : pDirent; Entry : Longint; @@ -84,7 +79,7 @@ begin end; end; -function TPlatformLinux.GetLogPath : WideString; +function TPlatformLinux.GetLogPath: WideString; begin if FindCmdLineSwitch( cUseLocalPaths ) then begin @@ -99,10 +94,11 @@ begin {$ENDIF} end; - forcedirectories( result ); + // create non-existing directories + ForceDirectories(Result); end; -function TPlatformLinux.GetGameSharedPath : WideString; +function TPlatformLinux.GetGameSharedPath: WideString; begin if FindCmdLineSwitch( cUseLocalPaths ) then Result := ExtractFilePath(ParamStr(0)) @@ -161,32 +157,4 @@ begin {$IFEND} end; -// FIXME: Maybe this should be TPlatformBase.Halt() for all platforms -procedure TPlatformLinux.Halt; -begin - System.Halt; -end; - -function TPlatformLinux.TerminateIfAlreadyRunning(var WndTitle : String) : Boolean; -begin - // Linux does not check for running apps at the moment - Result := false; -end; - -// FIXME: just a dirty-fix to make the linux build work again. -// This i the same as the corresponding function for windows -// (and MacOSX?). -// Maybe this should be TPlatformBase.FindSongFile() -function TPlatformLinux.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. -- cgit v1.2.3