-
Notifications
You must be signed in to change notification settings - Fork 3
/
mycrossplatform.pas
65 lines (53 loc) · 1.1 KB
/
mycrossplatform.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
unit MyCrossPlatform;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, Dos;
type
TMyCrossPlatform = class(TObject)
private
FCurDir: string;
FSeparator: Char;
FDumpsDir: string;
public
property Dir: string read FCurDir write FCurDir;
property Sep: Char read FSeparator write FSeparator;
property DumpsDir: string read FDumpsDir write FDumpsDir;
constructor Create;
destructor Destroy; override;
function FileExists(Filename: string): boolean;
end;
implementation
function TMyCrossPlatform.FileExists(Filename: string): boolean;
var
sDir: SearchRec;
begin
Result := False;
FindFirst(Filename, archive, sDir{%H-});
while (DosError = 0) do
begin
FindNext(sDir);
Result := True;
Break;
end;
FindClose(sDir);
end;
constructor TMyCrossPlatform.Create;
begin
// get current directory
getdir(0, FCurDir);
// set separator
{$IFDEF LINUX}
FSeparator := '/';
{$ELSE}
FSeparator := '\';
{$ENDIF}
FDumpsDir := FCurDir + FSeparator + 'dumps';
end;
destructor TMyCrossPlatform.Destroy;
begin
{$IFDEF LINUX}
{$ELSE}
{$ENDIF}
end;
end.