Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Need a little help with updating a FileSelect function.
#2
In general the only sure way to check if a filesystem operation is allowed is to do it and be prepared to catch the error. You could maybe try change into every directory immediately to test each one and thus filter the list presented to the user, but I think it's more confusing to see a list that has some entries mysteriously missing. An "access denied" or similar message would be perfectly acceptable to me when I open a directory (cf Windows Explorer, most other file managers).

In any case you need the error handling whenever doing filesystem operations because you don't know what other programs are also modifying the disk concurrently.

At least in Unix systems the root directory has the special property that the parent ".." is also the root, so if you do CHDIR ".." and _CWD$ you must have been in the root. I assume that holds true for windows too. Or just have an OS conditional and check _CWD$ for "/" or "C:" (or is it "C:\"?).
Reply


Messages In This Thread
RE: Need a little help with updating a FileSelect function. - by luke - 10-11-2024, 01:17 PM



Users browsing this thread: 2 Guest(s)