[Gambas-user] Doesn't IF NOT exist? Bug or feature? Or my bad logic?

Rolf-Werner Eilert eilert-sprachen at ...221...
Thu Sep 17 15:38:39 CEST 2009


Just stumbled over this when trying to implement a small copying function:

   FOR EACH datei IN Dir(opfad, odatei & ".*")
     IF NOT file.Ext(opfad &/ datei) = "lock" THEN
       COPY opfad &/ datei TO ziel &/ datei
       SELECT CASE file.Ext(ziel &/ datei)
       CASE "fehl", "feldbak", "felder", "notizen"
         SHELL "chgrp kartei " & ziel &/ datei WAIT
         SHELL "chmod 660 " & ziel &/ datei WAIT
       CASE "konto", "kontobak", "ktx", "ktxbak"
         SHELL "chgrp konto " & ziel &/ datei WAIT
         SHELL "chmod 660 " & ziel &/ datei WAIT
       END SELECT
     END IF
   NEXT

IF NOT ... = ... THEN

wouldn't copy anything, although only one file has the given extension. 
When I change this line into

IF file.Ext(opfad &/ datei) <> "lock" THEN

everything runs as expected. Doesn't make sense to me as both ways 
should mean the same in my understanding of logical NOT (which doesn't 
mean too much... :-) )

Regards

Rolf




More information about the User mailing list