mirror of https://gitlab.com/basile.b/dexed.git
more refact using helpers
This commit is contained in:
parent
767e315164
commit
6433118bea
|
@ -52,6 +52,7 @@ type
|
|||
function extractFileName: string;
|
||||
function extractFileExt: string;
|
||||
function extractFilePath: string;
|
||||
function extractFileDir: string;
|
||||
function fileExists: boolean;
|
||||
function dirExists: boolean;
|
||||
function upperCase: string;
|
||||
|
@ -351,6 +352,11 @@ begin
|
|||
exit(sysutils.extractFilePath(self));
|
||||
end;
|
||||
|
||||
function TStringHelper.extractFileDir: string;
|
||||
begin
|
||||
exit(sysutils.extractFileDir(self));
|
||||
end;
|
||||
|
||||
function TStringHelper.fileExists: boolean;
|
||||
begin
|
||||
exit(sysutils.FileExists(self));
|
||||
|
@ -969,7 +975,7 @@ var
|
|||
begin
|
||||
result := 0;
|
||||
while(true) do begin
|
||||
parent := ExtractFileDir(aFilename);
|
||||
parent := aFilename.extractFileDir;
|
||||
if parent = aFilename then exit;
|
||||
aFilename := parent;
|
||||
result += 1;
|
||||
|
@ -1003,14 +1009,14 @@ begin
|
|||
for i := sink.Count-1 downto 0 do
|
||||
begin
|
||||
while (countFolder(sink[i]) <> cnt) do
|
||||
sink[i] := ExtractFileDir(sink[i]);
|
||||
sink[i] := sink[i].extractFileDir;
|
||||
end;
|
||||
// common folder
|
||||
while(true) do
|
||||
begin
|
||||
for i := sink.Count-1 downto 0 do
|
||||
begin
|
||||
dir := ExtractFileDir(sink[i]);
|
||||
dir := sink[i].extractFileDir;
|
||||
j := sink.IndexOf(dir);
|
||||
if j = -1 then
|
||||
sink[i] := dir
|
||||
|
|
|
@ -73,20 +73,20 @@ begin
|
|||
if fDmdPath.fileExists then
|
||||
begin
|
||||
// add phobos
|
||||
fname := ExtractFileDir(fDmdPath);
|
||||
fname := ExtractFileDir(fname);
|
||||
fname := fDmdPath.ExtractFileDir;
|
||||
fname := fname.ExtractFileDir;
|
||||
with TLibraryItem(fCol.Add) do begin
|
||||
libAlias := 'phobos';
|
||||
libFile := fname + '\lib\phobos.lib';
|
||||
libSourcePath := ExtractFileDir(fname) + '\src\phobos';
|
||||
libSourcePath := fname.ExtractFileDir + '\src\phobos';
|
||||
end;
|
||||
// add druntime (no lib - only for DCD)
|
||||
fname := ExtractFileDir(fDmdPath);
|
||||
fname := ExtractFileDir(fname);
|
||||
fname := fDmdPath.ExtractFileDir;
|
||||
fname := fname.ExtractFileDir;
|
||||
with TLibraryItem(fCol.Add) do begin
|
||||
libAlias := 'druntime';
|
||||
libFile := '';
|
||||
libSourcePath := ExtractFileDir(fname) + '\src\druntime\import';
|
||||
libSourcePath := fname.ExtractFileDir + '\src\druntime\import';
|
||||
end;
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
|
|
@ -275,10 +275,10 @@ begin
|
|||
Caption := nme;
|
||||
SubItems.Add(prj.outputFilename);
|
||||
if str.Count = 1 then
|
||||
cdy := ExtractFileDir(str[0])
|
||||
cdy := str[0].extractFileDir
|
||||
else begin
|
||||
cdy := commonFolder(str);
|
||||
cdy := ExtractFileDir(cdy);
|
||||
cdy := cdy.extractFileDir;
|
||||
end;
|
||||
SubItems.Add(cdy);
|
||||
SubItems.Add(prj.filename);
|
||||
|
@ -367,11 +367,11 @@ begin
|
|||
str.Add(fProj.sourceAbsolute(i));
|
||||
// single source libs usually have the structure "src/<fname>"
|
||||
if str.Count = 1 then
|
||||
root := ExtractFileDir(str[0])
|
||||
root := str[0].extractFileDir
|
||||
// multi source libs have the structure "src/LibName/<fname>"/...
|
||||
else begin
|
||||
root := commonFolder(str);
|
||||
root := ExtractFileDir(root);
|
||||
root := root.extractFileDir;
|
||||
end;
|
||||
if root.isEmpty then
|
||||
begin
|
||||
|
|
|
@ -1952,7 +1952,7 @@ begin
|
|||
begin
|
||||
fMsgs.message(shortenPath(fDoc.fileName, 25) + ' successfully compiled',
|
||||
fDoc, amcEdit, amkInf);
|
||||
fRunProc.CurrentDirectory := extractFileDir(fRunProc.Executable);
|
||||
fRunProc.CurrentDirectory := fRunProc.Executable.extractFileDir;
|
||||
if runArgs.isNotEmpty then
|
||||
begin
|
||||
extraArgs.Clear;
|
||||
|
|
|
@ -668,7 +668,7 @@ begin
|
|||
fToolProc.Options := [poUsePipes];
|
||||
fToolProc.Executable := fToolExeName;
|
||||
fToolProc.OnTerminate := @toolTerminated;
|
||||
fToolProc.CurrentDirectory := ExtractFileDir(Application.ExeName);
|
||||
fToolProc.CurrentDirectory := Application.ExeName.extractFileDir;
|
||||
fToolProc.Execute;
|
||||
str := fDoc.Text;
|
||||
fToolProc.Input.Write(str[1], str.length);
|
||||
|
|
|
@ -203,7 +203,7 @@ begin
|
|||
end;
|
||||
fSymbols[CPFS] := str.Text;
|
||||
if str.Count = 1 then
|
||||
fSymbols[CPCD] := ExtractFileDir(str[0])
|
||||
fSymbols[CPCD] := str[0].extractFileDir
|
||||
else
|
||||
fSymbols[CPCD] := commonFolder(str);
|
||||
finally
|
||||
|
|
|
@ -424,7 +424,7 @@ begin
|
|||
fToolProc.Executable := exeFullName(ToolExeName);
|
||||
fToolProc.Options := [poUsePipes];
|
||||
fToolProc.ShowWindow := swoHIDE;
|
||||
fToolProc.CurrentDirectory := ExtractFileDir(Application.ExeName);
|
||||
fToolProc.CurrentDirectory := Application.ExeName.extractFileDir;
|
||||
fToolProc.OnTerminate := @toolTerminated;
|
||||
|
||||
// files passed to the tool argument
|
||||
|
|
Loading…
Reference in New Issue