The Current Directory


Each task in the Portfolio environment has a current directory associated with it. The current directory is the starting location for relative pathnames that are used with various File folio calls which take a pathname as an argument.

When an application is loaded from a file, it automatically gets its current directory set to where the program file is located. This makes it easier for the new task to find any files it needs.

The File folio provides two calls, GetDirectory() and ChangeDirectory(), to determine and change the location of the current directory of the current task.

Finding the Current Directory

GetDirectory() returns the item number of the current directory of the calling task.

Item GetDirectory( char *pathBuf, int32 pathBufLen )
If pathBuf is non-NULL, it points to a buffer of writable memory whose length is given in pathBufLen; the absolute pathname of the current working directory is stored into this buffer.

Changing the Current Directory

ChangeDirectory() changes the current directory of the current task to the absolute or relative location specified by the path.

Item ChangeDirectory( char *path )
The function returns the item number of the new directory, or a negative error code if an error occurs.