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

Emulate the FOLDER statement for the mini runtime


Here is the long sought after folder function.

'
' Function:FBFolder
'
'=================
CLEAR LOCAL MODE
DIM FolderName$,FolderVol%,ResultVol%
DIM pBlock;128
DIM PBlk&,OsErr
LOCAL FN FBFolder(FolderName$,FolderVol%)
'---------------------------------------
PBlk& = @pBlock
PBlk&.ioVRefNum% = FolderVol% 'Try Folder Vol
LONG IF LEN(FolderName$)
PBlk&.ioFileName& = @FolderName$ 'Try folder name
OsErr = FN OPENWD(PBlk&)
LONG IF OsErr
LONG IF FolderVol%
FolderVol% = 0 'Reset Vol
LONG IF FN DIRCREATE(PBlk&) = _NoErr
PBlk&.ioDirID& = 0
LONG IF FN OPENWD(PBlk&) = _NoErr
FolderVol% = PBlk&.ioVRefNum%
END IF
END IF
XELSE
PBlk&.ioDirID& = 0
END IF
XELSE
FolderVol% = PBlk&.ioVRefNum% 'Set Volume
END IF
END IF

PBlk&.ioFileName& = 0 'Reset Name
LONG IF FolderVol%
OsErr = FN SETVOL(PBlk&)
XELSE
IF OsErr = 0 THEN OsErr = FN GETVOL(PBlk&)
END IF
'
IF OsErr = 0 THEN ResultVol% = PBlk&.ioVRefNum%
'
END FN = ResultVol%

-STAZ ~)~