GetDirName Works Only for Boot Drive in Macintosh QuickBASIC (64104)






This article was previously published under Q64104

SUMMARY

The GetDirName Toolbox Library (MBLC) routine correctly returns the folder name (commonly called the pathname) when given a volume reference number of either -1 or 0. Different numbers representing other drives either give the error message "String Too Long" if a device is present and being used, or a null or meaningless string if the boot drive is the only device active.

Microsoft has confirmed this to be a problem in Microsoft QuickBASIC version 1.00 for Apple Macintosh. We are researching this problem and will post new information here as it becomes available.

MORE INFORMATION

When a hard or floppy disk is used in a Macintosh computer, the Finder displays an icon in the upper-right corner to indicate its presence. A hidden integer value is also assigned to the device in a field of a record structure that defines, among other things, available storage areas to the machine. These integer values can be used in a program to refer to that device. The standard set of assigned values starts at -1 and decrements by 1 for each additional device in the order the devices are provided to the machine.

The QuickBASIC MBLC routine GetDirName will return the boot folder name only. Any other device known to the Finder (via an assigned device number) will not be correctly identified by the GetDirName function call. To find other volume names, Toolbox calls found in the "Inside Macintosh" series by Apple Computer (published by Addison-Wesley) must be used.

The following code sample demonstrates the GetDirName problem:

Sample Code

x$ = ""            REM  Initialize the string for the toolbox call
GetDirName -1, x$  REM  Returns the boot volume name to x$
PRINT x$
GetDirName -2, x$
REM  This function call should return the second volume name listed in
REM  the Finder window to x$. However, if there is no disk icon
REM  present, a null or useless string will be returned, and, if a
REM  device is present, the error message "String Too Long" is
REM  displayed.
PRINT x$
INPUT "Done, hit return";  x$
				

Modification Type: Minor Last Reviewed: 1/9/2003
Keywords: KB64104