Because FileSize() returns false positives if rejected characters in pathname,
it falls back to CreateDirectory() or api call to SHCreateDirectory_() to know for certain if a path exists?
Or since FileSize() returns codes, maybe a new error code can be created?
EDIT: PathFileExists_(Fpathname$) does not return false positives if wildcard characters in Fpathname$.
[CreateDirectory]Return error code for failure.
[CreateDirectory]Return error code for failure.
Last edited by skywalk on Mon Mar 26, 2018 8:46 pm, edited 1 time in total.
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
Re: [CreateDirectory]Return error code for failure.
Another (secure) way, check filename before check size or exist
CheckFilename()
Returns nonzero if the filename does not contain invalid characters and zero if it does.
= bad filename for all
But you're right, actually, it would be nice if FileSize automatically tests if the file name is valid before continuing.
CheckFilename()
Returns nonzero if the filename does not contain invalid characters and zero if it does.
Code: Select all
Debug CheckFilename("c:\try3\z|z")
Debug CheckFilename("c:\try3\z:z")
Debug CheckFilename("c:\try3\z"+#DQUOTE$+"z")
Debug CheckFilename("c:\try3\z<z")
Debug CheckFilename("c:\try3\z>z")
Debug CheckFilename("c:\try3\z*z")
Debug CheckFilename("c:\try3\z?z")
Code: Select all
0
0
0
0
0
0
0
But you're right, actually, it would be nice if FileSize automatically tests if the file name is valid before continuing.