diff --git a/main.pas b/main.pas index 7143342..1ff26df 100644 --- a/main.pas +++ b/main.pas @@ -2815,15 +2815,14 @@ result:=(filesStayFlaggedForMinutes > 0) and (trunc(abs(now()-t)*24*60) <= filesStayFlaggedForMinutes) end; // isNew -function getFiles(mask:string):TstringList; +function getFiles(mask:string):TStringDynArray; var sr: TSearchRec; begin -result:=TstringList.create; -result.CaseSensitive:=FALSE; -if findFirst(exePath+'*.diff.tpl', faAnyFile, sr) = 0 then +result:=NIL; +if findFirst(mask, faAnyFile, sr) = 0 then try - repeat result.add(sr.name) + repeat addString(sr.name, result) until findNext(sr) <> 0; finally findClose(sr) end; end; // getFiles @@ -2845,20 +2844,6 @@ var result:=TRUE; end; // add2diff - procedure loadStar(); - var - list: TstringList; - s: string; - begin - list:=getFiles(exePath+'hfs.diff.*.tpl'); - try - list.sort(); - for s in list do - add2diff(s); - finally list.free - end; - end; - begin result:=''; diff:=''; @@ -2904,7 +2889,8 @@ while assigned(f) do f:=f.parent; first:=FALSE; end; -loadStar(); +for s in sortArray(getFiles(exePath+'*.diff.tpl')) do + add2diff(loadTextFile(s)); result:=diff; end; // getRecursiveDiffTplAsStr diff --git a/todo.txt b/todo.txt index 5500529..251004f 100644 --- a/todo.txt +++ b/todo.txt @@ -1,7 +1,15 @@ ++ expiring links +* dismiss regexp lib http://docwiki.embarcadero.com/Libraries/Rio/en/System.RegularExpressions.TRegEx ++ ipv6 ++ load *.events ++ url auth limited to resource ++ global limit speed for downloads (browsing excluded) ++ [tpl id] [SECTION|for-tpl=MASK] * consider letting comment "protected" files. Can it really cause harm? * flag to enable lnk files in a folder (disabled by default) + sign exe http://www.rejetto.com/forum/hfs-~-http-file-server/'unsafe'/msg1061437/#msg1061437 -cache reReplace +* cache reReplace ++ {.calc.} to have a third numeric parameter that becomes 'x' symbol + hash&salt passwords - setInterval > setTimeout + target=_blank as an option on links diff --git a/utillib.pas b/utillib.pas index 86368f9..16f4deb 100644 --- a/utillib.pas +++ b/utillib.pas @@ -178,7 +178,7 @@ function idxOf(s:string; a:array of string; isSorted:boolean=FALSE):integer; function stringExists(s:string; a:array of string; isSorted:boolean=FALSE):boolean; function listToArray(l:Tstrings):TstringDynArray; function arrayToList(a:TStringDynArray; list:TstringList=NIL):TstringList; -procedure sortArray(var a:TStringDynArray); +function sortArray(a:TStringDynArray):TStringDynArray; // convert function boolToPtr(b:boolean):pointer; function strToCharset(s:string):Tcharset; @@ -2639,7 +2639,7 @@ accounts[i]:=acc; result:=@accounts[i]; end; // createAccountOnTheFly -procedure sortArray(var a:TStringDynArray); +function sortArray(a:TStringDynArray):TStringDynArray; var i, j, l: integer; begin @@ -2647,6 +2647,7 @@ l:=length(a); for i:=0 to l-2 do for j:=i+1 to l-1 do swapMem(a[i], a[j], sizeof(a[i]), ansiCompareText(a[i], a[j]) > 0); +result:=a; end; // sortArray procedure onlyForExperts(controls:array of Tcontrol);