Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Need a little help with updating a FileSelect function.
#6
(10-11-2024, 03:15 PM)RhoSigma Wrote: Hi Dav,
below is the logic I use in my GuiTools, but it's windows only. I've no idea how to figure out if you're in the root under Linux/Mac as those don't use the ":" as far as I know. Also I'm not sure if those platforms behave the same way as Windows regarding the error numbers.

Code: (Select All)
'curr$ = the directory to check
IF NOT _DIREXISTS(curr$) THEN
    IF LEN(curr$) = 3 AND RIGHT$(curr$, 2) = ":\" THEN 'is root ??
        'permission denied or no media in (removeable) drive
    ELSE
        'path not found
    END IF
ELSE
    IF LEN(curr$) > 3 OR MID$(curr$, 2, 1) <> ":" THEN 'is not root or relative ??
        oldCurr$ = _CWD$
        ON ERROR GOTO internalHandler
        lastErr% = 0
        CHDIR curr$
        ON ERROR GOTO 0
        IF lastErr% = 0 THEN
            'path is accessible
        ELSEIF lastErr% = 76 THEN
            'permission denied
        END IF
        CHDIR oldCurr$
    END IF
END IF

internalHandler:
lastErr% = ERR
RESUME NEXT

Thank you.  I can use this.

- Dav

Find my programs here in Dav's QB64 Corner
Reply


Messages In This Thread
RE: Need a little help with updating a FileSelect function. - by Dav - 10-11-2024, 05:55 PM



Users browsing this thread: 6 Guest(s)