FB II Compiler

PG PRO

Debugging

Memory

System

Mathematics

Resources

Disk I/O

Windows

Controls

Menus

Mouse

Keyboard

Text

Fonts

Drawing

Sound

Clipboard

Printing

Communication

ASM

Made with FB

DISK I/O

Find the folder name of the running app.


it is highly recommended to read the IM Files volume that can be downloaded from Apple's developer site. You will get a lot of insights, e.g. that working directories are definitely outdated.

Although I fully agree with Joe Wilkins on the folder names, here is a code snippet that returns the name:
DIM iPB.104                                  '
DirCatalogInformationParamBlock record
DIM 63 fldNme$                            ' 64 bytes required

iPB.ioNamePtr&    = @fldNme$    ' pointer to (empty) folder name
iPB.ioFDirIndex% = -1                  ' want information about directories (folder)
iPB.ioVRefNum% = vRefNum% ' volume of your file
iPB.ioDrDirID&     = parID&         ' directory of the folder your file is in
err% = FN GETCATINFO(@iPB) ' delivers folder name, etc.
' now you will find the folder name in the variable fldNme$
The modern way to obtain the vRefNum% and the parID& of your file is to use the FileSystemSpecification record (IM-1992/Files/2-86).
Herbie

Joe and Herbie, for your assistance. I definitely need to learn more about GETCATINFO.

Sometimes sleeping on it helps. Here's the solution that I came up with before checking the list this morning (didn't realize how fast the replies would be):
BEGIN RECORD fsSpecRecord
  DIM vrn%
  DIM parID&
  DIM 64 fName$
END RECORD

LOCAL
DIM fsSpec as fsSpecRecord
DIM vrn%,osErr%
LOCAL FN GetFolderInfo
  vrn%=SYSTEM(_aplVol)
  osErr%=FN fsmakefsspec(vrn%,0,"",fsSpec)
  PRINT "App's WD name is:";fsSpec.fName$
  osErr%=FN fsmakefsspec(0,fsSpec.parID&,"",fsSpec)
  PRINT "Parent folder of App is:";fsSpec.fName$
END FN

FN GetFolderInfo
I like to have the names of the folders because I like to double-check what I'm doing very early on during a process, so that I'm sure it's okay to continue coding the process.
Mark G.