I was publishing some photos/movies of my 27 month old son taking ski lessons (see Sharing Digital Pictures of your friend’s ) and I received an unexpected error. I narrowed down the code to this fragment:
CREATE TABLE (CPATH+”temp”) (name c(10))
This is the error I receive File ‘c:\inetpub\wwwroot\temp.dbf’ does not exist.
Hmmm… I wondered what was going on. Upon further investigation, I could only reproduce the error on the VFP9 RTM build 2412, but not the latest internal build.
A little digging revealed the issue. When PACKing a table, a temporary virtual file is created into which the non-deleted records are copied. This virtual file is created with a temporary full path file name in the same directory as the table.
When the virtual file is closed after the PACK operation, it is converted from a virtual (in memory) to a real file. That folder happened to be marked as a System folder, and there was code that checked to see if the folder for the temp file existed. If not, it creates the real temp file in the current directory with a new temp name. The temp file is then renamed to be the original file. The rename fails if the directories are different. The code then tries to open the new file, which isn’t there.
The code to check if the folder existed did not check Hidden or System directories. I fixed that a few months ago.