[Coco] Get the current work path

Bill Pierce ooogalapasooo at aol.com
Thu Feb 15 07:51:21 EST 2018


To get the "complete" pathlist to the current data or cmds dir is a very complex procedure and no, there is no system call to do this and other than forking PXD/PWD, there is no easy way to do this. OS9/NitrOS9 only stores the direct sector number of these values and no name or path, so OS9/NitrOS9 has no knowledge of how it got there. This is why you have to type a complete pathlist or relative pathlist from the current dir when using CHD or CHX cmds. OS9 only knows where it's at, not where it's been.

To get the complete pathlist, one must recurse back to the root dir (one dir at a time) by using the ".." path, then checking each entry in the previous dir list for an entry who's starting sector matches that of the dir above it, therefore getting the previous dirname. This is done for each dir until the root is reached, therefore building the pathlist.

Yeah... a lot just to get a pathlist. I investigated this very thing extensively while writing the MShell File Manager which deals with dirs of all types and keeps track of everything dir related. MShell has it's own builtin utility subroutine which does the PXD/PWD without "forking" out to external cmds.
The best reference I found for the quickest method to do this was in Zack Session's "pwd_pxd_C.lzh" which is a C utility to get the current data & cmds dirs. This file can be found in the RTSI archives.

 

 

Bill Pierce
"Charlie stole the handle, and the train it won't stop going, no way to slow down!" - Ian Anderson - Jethro Tull

My Music from the Tandy/Radio Shack Color Computer 2 & 3
https://sites.google.com/site/dabarnstudio/
Co-Contributor, Co-Editor for CocoPedia
http://www.cocopedia.com/wiki/index.php/Main_Page

E-Mail: ooogalapasooo at aol.com

 




More information about the Coco mailing list