All functions packed on archive as separate projects, available under the post below.
1) DirW
Prototype is: Dir$(Path with mask or backslash at the end, opt_mask of allowed attributes, opt_return folders? )
Difference to original VB6 Dir$():
Fixed bug, when Dir cannot handle attribute: read only (vbReadOnly)
Added attributes:
- reparse points (symlinks / junctions) (vbReparse)
- all file objects (vbAll)
- vbFile (files only, without folders)
Enum VbFileAttribute "overloaded" by own: I removed all superfluous attributes, which original VB6 dir() are still not used in any way; I leave meaningful attributes only.
+ 3-rd optional argument (FoldersOnly); if true, it will filter files and leave folders only in output.
Function also automatically filter folders-aliases "." и ".."
Code based on earlier VB6() Dir$ reversing by @The Trick.
2) MkDirW()
Prototype is: MkDirW(Path to folder to create, opt_LastComponentIsFile as boolean) as boolean
LastComponentIsFile - true, if you plan to specify filename as a last part of path component
Return value: true, if successfully created or if folder is already exist
- support several env. var-s on one line, like EnvironW("%UserName% - %UserDomain%")
- require %var%, i.e. each environment variable should be surrounded by % signs.
- automatically correct and "right" (in the sense, like if we wanted to do so from a 64-bit application) to expand under WOW64 such env. variables as:
- %PROGRAMFILES%
- %COMMONPROGRAMFILES%
and get on 64-bit OS, respectively:
- C:\Program Files, but not C:\Program Files (x86)
- C:\Program Files\Common Files, but not C:\Program Files (x86)\Common Files
4,5) AppPathW(), AppExeNameW()
Prototypes are:
- AppPathW$(opt_bGetFullPath as boolean)
- AppExeNameW$(opt_WithExtension As Boolean)