rejetto forum
Software => HFS ~ HTTP File Server => Programmers corner => Topic started by: Mars on September 04, 2009, 09:50:45 PM
-
utilib.pas
function newMtime(fn:string; var previous:Tdatetime):boolean;
function dirCrossing(s:string):boolean;
function forceDirectory(path:string;overwrite:boolean=FALSE):boolean; //mod by mars
function moveToBin(fn:string; force:boolean=FALSE):boolean;
function uri2disk(url:string; root:Tfile=NIL):string;
......
implementation
....
function forceDirectory(path:string;overwrite:boolean=FALSE):boolean; //mod by mars
var
s: string;
begin
result:=TRUE;
path:=excludeTrailingPathDelimiter(path);
if path = '' then exit;
try
if overwrite then movetobin(path,TRUE); //add by mars
except end;
if directoryExists(path) then exit;
s:=ExtractFilePath(path);
forceDirectory(s);
result:=CreateDir(path);
end; // forceDirectory
main.pas
if name = 'mkdir' then
spaceIf(forceDirectory(uri2diskMaybeFolder(p),isTrue(par('overwrite')))); //mod by mars
with this update , you can overwrite an existing folder by moving it to the recycled bin , you lose nothing and if it is necessary you can recover it :)
usage: {.mkdir|foldername|overwrite=true.}
-
{.mkdir|foldername|overwrite=1.}
instead of
{.delete|foldername.}{.mkdir|foldername.}
i don't see a real improvement
-
The uniformity my dear friend, the uniformity...,
{.add folder|real or virtual| ....... | overwrite=1.}
{.mkdir| ................................. | overwrite=1.}
I LIKE THE UNIFORMITY , then you have to do what is necessary ;)