compared to VO:
Dirmake() returns -1 instead of 183 ( "already exists" ) if the dir to create already exist.
DirRemove() returns -1 instead of 2 ( "dir not found" ), if the dir to remove doesn´t exist.
In GitHub i see that the Ferror() value setting was added to both funcs. i´ve made some tests in VO and noticed that VO doesn´t set the Ferror() value in both funcs.
About the possibility that Dirmake() or DirRemove() might return -1 the VO-Help says:
[...]
0 if successful; -1 if there is an argument error; otherwise, the DOS error code
[...]
Strange - what else than a DOS error is an "argument" error ? I´ve tried both funcs with several wrong params but I did not manage it that VO returns -1, it always ends up with a known Dos error.
so both funcs might look:
Code: Select all
FUNCTION DirMake (cDir AS STRING) AS INT
LOCAL result AS INT
TRY
IF !Directory.Exists(cDir)
Directory.CreateDirectory(cDir)
result := 0
ELSE
result := 183 // "dir already exists" instead of -1
ENDIF
CATCH e AS Exception
result := (INT) GetErrorCodeFromException ( e )
END TRY
RETURN result
FUNCTION DirRemove(cDir AS STRING ) AS INT
LOCAL result AS INT
TRY
IF Directory.Exists(cDir)
Directory.Delete(cDir,FALSE )
result := 0
ELSE
result := 2 // "Dir not found" instead of -1
ENDIF
CATCH e AS Exception
result := (INT) GetErrorCodeFromException ( e )
END TRY
RETURN result
regards
Karl-Heinz