I've resolved the problem with renaming a file on the QL:
- If "oldfile" doesn't exist, Pascal barfs with runtime error 2 -- file not found.
- If newfile already exists, Pascal barfs with runtime error 5 -- file access error (sorry, the best I can do!)
- If oldfile there and newfile not, the file is renamed.
Unfortunately, I found another foible in SMSQ and deleteing a directory.
- If directory not empty, runtime error 5 occurs. File access error. (Sorry, best I can do!)
- If directory present, and empty of files, directory is deleted.
- If directory is not present, no errors occur! We expect a runtime error 3 Path not found.
So, I set up a couple of assembly language tests and IO_DELET doesn't care if the file is found or not, it doesn't return ERR_NF from the trap, it returns 0 instead. Hmmm.
I tried to open the non-existent directory, ram1_xxxxxx, as a directory before attempting to delete it, and it worked! Checking with the Channels thing, it had opened RAM1_ as a directory instead. It appears that SMSQ/QPC will do this if the given full filename is not a directory, it opens the next level up until it comes across something that is a directory? Or so it would seem.
This means that the QL version of rmdir, under Pascal, is different from the Linux version. Trying to delete a directory that's not there is expected to give error 3. Does anyone care?
Latest patch file attached below here.