VFP has always been a bit funny about filename cases. More specifically, how it works with filename case is not documented. It will translate filenames to lower case in some cases, and to upper in others, and leave it alone in yet others.
If you are accessing files on a filesystem that is case sensitive and have files with names that differ only in case, vfp can't distinguish one from the other. If for example I have aA.dbf and Aa.DBF, and I do a dir of the directory, it shows both files as AA.DBF. VFP can't tell one from the other - it probably uses the natural order of the files and takes the first one it finds regardless of case.
When creating files, it usually defaults to upper case if nothing is provided. If you create a table using CREATE TABLE, it will observe the case of the filename you give it, but if you don't give it a .dbf extension, it will create the extension in upper case. If you do this, for example:
CREATE TABLE WikIpArt.dbF ( partcode c(10), part_id n(4), descrptn c(25) )
You get a file named WikIpArt.dbF. If you omit the .dbF, you get wikipart.DBF. If you then index it and don't specify the CDX name, it will give you a CDX file using your filename with original case, and upper case .CDX. If you do this:
INDEX ON partcode TAG partcode OF wiKipaRt.CdX
You will now have WikIpArt.dbF and wiKipaRt.CdX.
If you run your code, the delete tag all will delete the CDX, and the first index command recreates the CDX with the same funny case - it appears that VFP buffers or otherwise remembers the file name, with case. If there is no existing index file, it creates it all in upper case. And if the pack actually results in the file being deleted and recreated, it may or may not create it all in upper case.
More File Case Fun
The following commands/functions give LOWER case results ONLY:
- COPY FILE file1 TO file2
- RENAME file1 TO file2
The following commands/functions give Actual case results:
- ADIR() *** Only if Flag Parameter is chosen otherwise default is UPPER case
- MD or MKDIR
The following commands/functions give UPPER case results ONLY:
- SYS() *** I haven't tested all of these but typically UPPER only
Moral of the story - make all file i/o case insensitive, because even if the file system supports case sensitivity, VFP does not reliably do so. If you have non-VFP related functions that have issues with case, fix them to be case insensitive.
( Topic last updated: 2008.08.31 10:55:36 AM )