Talk:Recursive filesearch

From Freepascal Amiga wiki
Revision as of 12:06, 18 August 2014 by Molly (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Hint "?" Operator does not exist but there is a replacement:

if (ap^.ap_Info.fib_DirEntryType < 0) then 
begin 
  s := '';  
end else
  s := 'Dir';

one could write:

s := IfThen(ap^.ap_Info.fib_DirEntryType < 0, '', 'Dir')

(if for strings need Unit StrUtils, for number need unit Math)

Besides I'm a little bit worried, that a recursive Filesearch is not coded recursively :-) --ALB42 (talk) 11:11, 17 August 2014 (CEST)


Indeed, i 'missed' the ifthen solution. Something i came to learn about a little later on. fwiw: i initially used my own iif routines, but ripped them out for this routine to not confuse the reader (in original a-e post).

Sorry for the 'simple' copy-paste. I'll try adding explanations later on. Which btw will also handle the topic of why this recursive search does not call itself recursively (i can't help commodore invented 'dumbwitted' OS calls that does things automatically for us ;-p).

I'll add the Freepascal native counterpart alongside as well to compare/explain.