aboutsummaryrefslogtreecommitdiffstats
path: root/Game/Code/Classes/UPlatformWindows.pas
diff options
context:
space:
mode:
Diffstat (limited to 'Game/Code/Classes/UPlatformWindows.pas')
-rw-r--r--Game/Code/Classes/UPlatformWindows.pas59
1 files changed, 54 insertions, 5 deletions
diff --git a/Game/Code/Classes/UPlatformWindows.pas b/Game/Code/Classes/UPlatformWindows.pas
index 93e72e7a..d4ba757a 100644
--- a/Game/Code/Classes/UPlatformWindows.pas
+++ b/Game/Code/Classes/UPlatformWindows.pas
@@ -8,19 +8,30 @@ interface
{$I switches.inc}
-uses Classes, UPlatform;
+uses Classes,
+ UPlatform;
type
- TPlatformWindows = class(TPlatform)
+ TPlatformWindows = class( TInterfacedObject, IPlatform)
public
- Function DirectoryFindFiles(Dir, Filter : WideString; ReturnAllSubDirs : Boolean) : TDirectoryEntryArray; override;
- function TerminateIfAlreadyRunning(var WndTitle : String) : Boolean; override;
+ Function DirectoryFindFiles(Dir, Filter : WideString; ReturnAllSubDirs : Boolean) : TDirectoryEntryArray;
+ function TerminateIfAlreadyRunning(var WndTitle : String) : Boolean;
+ function GetGamePath: WideString;
+ function FindSongFile(Dir, Mask: widestring): widestring;
+
+ procedure halt;
+
+ function GetLogPath : WideString;
+ function GetGameSharedPath : WideString;
+ function GetGameUserPath : WideString;
end;
implementation
-uses SysUtils, Windows;
+uses SysUtils,
+ Windows,
+ Forms;
type
@@ -175,4 +186,42 @@ begin
FindCloseW(SR);
end;
+function TPlatformWindows.GetGamePath: WideString;
+begin
+ // Windows and Linux use this:
+ Result := ExtractFilePath(ParamStr(0));
+end;
+
+procedure TPlatformWindows.halt;
+begin
+ application.terminate;
+end;
+
+function TPlatformWindows.GetLogPath : WideString;
+begin
+ result := ExtractFilePath(ParamStr(0));
+end;
+
+function TPlatformWindows.GetGameSharedPath : WideString;
+begin
+ result := ExtractFilePath(ParamStr(0));
+end;
+
+function TPlatformWindows.GetGameUserPath : WideString;
+begin
+ result := ExtractFilePath(ParamStr(0));
+end;
+
+ function TPlatformWindows.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.