Function group Execute on client Platform(s)
FileOps NO All




Changes the current working directory to the directory named in cPath. Pathnames can be over 255 characters, which was the limit in Studio 8.0.1 or earlier.

$changeworkingdir() only switches between directories on the same drive, not between drives. The function returns an error code, or zero if successful: see the FileOps function error codes.

Note: Applications on macOS do not have a working directory. If you use this function on macOS, it returns the error code kFileOpsNoOperation.


Switch platform()
  Case 'X' ;; for macOS
    Quit method ;; working directories not supported
  Case 'U' ;; for Linux
    Do FileOps.$changeworkingdir('/omnis/examples') Returns lError
  Default ;; for Windows platforms
    Do FileOps.$changeworkingdir('c:\omnis\examples') Returns lError
End Switch
OK message {Working directory is now: [FileOps.$getworkingdir()]}