An initial part of my program requires that it tests whether a directory exists, and, if not, attempts to create one. I have been using a version of the one found on the wiki site, which tries to open the file "...\NUL".
Code: Select all
DEF FN_dircreated(dir$) IF FN_direxists(dir$) THEN = TRUE OSCLI "MKDIR """ + dir$ + """" IF FN_direxists(dir$) THEN = TRUE ELSE = FALSE DEF FN_direxists(dir$) LOCAL F% IF RIGHT$(dir$) = "\" THEN dir$ = LEFT$(dir$) F% = OPENIN(dir$+"\NUL") IF F% CLOSE #F% : = TRUE ELSE = FALSE
I have a feeling that, many years ago, I seemed to remember a way of creating a directory using a SYS command that could return a result. This, theoretically, would prevent the untrappable error, whether the file existed or not, whether the area was restricted or not. If this is true, however, I cannot remember the command line, nor can I find anything on the MS information site to help. Does anyone know if I'm remembering right?