home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2000 February
/
Chip_2000-02_cd.bin
/
zkuste
/
Delphi
/
navody
/
tt
/
objvm.exe
/
UNITS
/
DIrs.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
1998-04-26
|
1KB
|
45 lines
unit Dirs;
interface
Uses SysUtils;
function OriginDir:string;
function OriginDirFile(const s:string):String;
function DirFile(const s,f:string):string;
function UniqueFile(const Dir,Prefix,Suffix:string):string;
implementation
function OriginDir;
begin
OriginDir:=ExtractFilePath(ParamStr(0));
end;
function OriginDirFile;
Var ss:STring;
begin
ss:=OriginDir;
if ss[Length(ss)]='\' then
OriginDirFile:=ss+s
else
OriginDirFile:=ss+'\'+s;
end;
function DirFile(const s,f:string):string;
begin
Result:=S;
if s[length(s)]<>'\' then
begin
Result:=Result+'\';
end;
Result:=Result+f;
end;
function UniqueFile(const Dir,Prefix,Suffix:string):string;
Var i:integer;
begin
i:=0;
Result:=DirFile(Dir,Prefix+IntToStr(i)+Suffix);
While FileExists(Result) do
begin
inc(i);
Result:=DirFile(Dir,Prefix+IntToStr(i)+Suffix);
end;
end;
end.