Directory and long path names


> directory() and related function

DIRECTORY() in Harbour makes the same job as in Clipper. The only differences are platform dependent. Harbour supports wider set of attributes.

Wildcards are also platform dependent. In *nixes fnmatch() function is used internally with the following extensions: * – any number of characters

? – exactly one character. In DOS/OS2/WIN it accepts also “no character” is it’s at the end of filename part. [] – enclose group of characters, i.e. [abc] – characters “a”, “b” and “c” [a-z] – range of characters from “a” to “z” [-A-F0-9.] – characters: – A B C D E F 0 1 2 3 4 5 6 7 8 9 . please also remember that in *nixes file systems uses case sensitive names.

Mask which covers all files is “*”, function hb_osFileMask() returns mask for all files on given platform.

In DOS, OS2 and MS-Windows Mask which covers all files is “*.*” “*” is only for files without extension. In *nixes “*.*” means files which have “.” in the name. In MS-Windows (and maybe also DOS and OS2 with LFN support) there are some tricks which tries to emulate DOS behavior with fixed 8.3 format. I do not know exact tricks they implemented.

Some simple mapping like support for all files with mask like ???????.??? can be easy detected but if you made some more advances masks, i.e. with more then one dot then the behavior is really funny.

Anyhow in functions like directory() in DOS, OS2 and MS-Win file mask is interpreted by system not Harbour so the differences to expected behavior should be reported to MS not us. In these systems only one Harbour function: hb_FileMatch() makes own file mask comparison. Anyhow the differences are can appear only due to missing DOS hacks. In *nixes hb_FileMatch() uses internally fnmatch() so here OS evaluates passed file masks. BTW hb_DirScan() uses internally hb_FileMatch().

best regards,


One response to “Directory and long path names

  1. Pingback: Harbour Quotations | Viva Clipper !

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s