mirror of https://gitlab.com/basile.b/dexed.git
fix #26, DUB excludedSourceFiles are not well managed
This commit is contained in:
parent
7915a315ee
commit
f0bd30c948
|
@ -268,6 +268,13 @@ type
|
||||||
*)
|
*)
|
||||||
function isBlank(const str: string): boolean;
|
function isBlank(const str: string): boolean;
|
||||||
|
|
||||||
|
(**
|
||||||
|
* Converts a global match expression to a regular expression.
|
||||||
|
* Limitation: Windows style, [] not handled.
|
||||||
|
* src: github.com/spring/svn-spring-archive/blob/master/branches/greenail/rts/System/Platform/filefunctions.h#L29
|
||||||
|
*)
|
||||||
|
function globToReg(const glob: string ): string;
|
||||||
|
|
||||||
var
|
var
|
||||||
// supplementatl directories to find background tools
|
// supplementatl directories to find background tools
|
||||||
additionalPath: string;
|
additionalPath: string;
|
||||||
|
@ -1160,6 +1167,52 @@ begin
|
||||||
exit(false);
|
exit(false);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function globToReg(const glob: string ): string;
|
||||||
|
procedure quote(var r: string; c: char);
|
||||||
|
begin
|
||||||
|
if not (c in ['a'..'z', 'A'..'Z', '0'..'9', '_']) then
|
||||||
|
r += '\';
|
||||||
|
r += c;
|
||||||
|
end;
|
||||||
|
var
|
||||||
|
i: integer = 0;
|
||||||
|
b: integer = 0;
|
||||||
|
begin
|
||||||
|
result := '^';
|
||||||
|
while i < length(glob) do
|
||||||
|
begin
|
||||||
|
i += 1;
|
||||||
|
case glob[i] of
|
||||||
|
'*': result += '.*';
|
||||||
|
'?': result += '.';
|
||||||
|
'{':
|
||||||
|
begin
|
||||||
|
b += 1;
|
||||||
|
result += '(';
|
||||||
|
end;
|
||||||
|
'}':
|
||||||
|
begin
|
||||||
|
b -= 1;
|
||||||
|
result += ')';
|
||||||
|
end;
|
||||||
|
',':
|
||||||
|
begin
|
||||||
|
if b > 0 then
|
||||||
|
result += '|'
|
||||||
|
else
|
||||||
|
quote(result, glob[i]);
|
||||||
|
end;
|
||||||
|
'\':
|
||||||
|
begin
|
||||||
|
i += 1;
|
||||||
|
quote(result, glob[i]);
|
||||||
|
end;
|
||||||
|
else
|
||||||
|
quote(result, glob[i]);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
initialization
|
initialization
|
||||||
registerClasses([TCEPersistentShortcut]);
|
registerClasses([TCEPersistentShortcut]);
|
||||||
end.
|
end.
|
||||||
|
|
|
@ -5,7 +5,8 @@ unit ce_dubproject;
|
||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, xfpjson, xjsonparser, xjsonscanner, process, strutils, LazFileUtils,
|
Classes, SysUtils, xfpjson, xjsonparser, xjsonscanner, process, strutils,
|
||||||
|
LazFileUtils, RegExpr,
|
||||||
ce_common, ce_interfaces, ce_observer, ce_dialogs, ce_processes;
|
ce_common, ce_interfaces, ce_observer, ce_dialogs, ce_processes;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
@ -595,6 +596,7 @@ begin
|
||||||
end;
|
end;
|
||||||
var
|
var
|
||||||
pth: string;
|
pth: string;
|
||||||
|
glb: TRegExpr;
|
||||||
begin
|
begin
|
||||||
fSrcs.Clear;
|
fSrcs.Clear;
|
||||||
if not assigned(fJSON) then
|
if not assigned(fJSON) then
|
||||||
|
@ -665,11 +667,26 @@ begin
|
||||||
conf := getCurrentCustomConfig;
|
conf := getCurrentCustomConfig;
|
||||||
if conf.isNotNil then
|
if conf.isNotNil then
|
||||||
getExclusion(conf);
|
getExclusion(conf);
|
||||||
for i := fSrcs.Count-1 downto 0 do
|
if lst.Count > 0 then
|
||||||
|
begin
|
||||||
|
glb := TRegExpr.Create;
|
||||||
|
try
|
||||||
for j := 0 to lst.Count-1 do
|
for j := 0 to lst.Count-1 do
|
||||||
if SameFileName(fSrcs[i], lst[j]) then
|
begin
|
||||||
|
try
|
||||||
|
glb.Expression := globToReg(lst[j]);
|
||||||
|
glb.Compile;
|
||||||
|
for i := fSrcs.Count-1 downto 0 do
|
||||||
|
if glb.Exec(fSrcs[i]) then
|
||||||
fSrcs.Delete(i);
|
fSrcs.Delete(i);
|
||||||
// TODO-cDUB: manage exclusions with http://dlang.org/phobos/std_path.html#.globMatch
|
except
|
||||||
|
continue;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
finally
|
||||||
|
glb.Free;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
finally
|
finally
|
||||||
lst.Free;
|
lst.Free;
|
||||||
end;
|
end;
|
||||||
|
|
Loading…
Reference in New Issue