baSysFolder gets the location of a system directory.


Windows and Macintosh


Result = baSysFolder( Folder )


Folder is the name of the folder to return. Can be one of the following:
"windows"  returns the Windows folder
"system"  the System folder
"system16"  the System folder for 16 bit files
"system32"  the System folder for 32 bit files
"temp"  the folder used for temporary files
"current"  the current DOS directory
"desktop"  the desktop folder
"common desktop"  the common desktop folder for all users
"groups"  the program groups folder in the start menu
"common groups"  the common program groups folder for all users
"start menu"  the start menu folder
"common start menu"  the common start menu for all users
"personal"  the users personal documents folder
"favorites"  the users favorites folder
"startup"  the 'Start Up' program group folder
"common startup"  the 'Start Up' folder for all users
"recent"  the 'Recent documents' folder
"sendto"  the 'Send To' folder
"network"  the 'Network Neighborhood' folder
"fonts"  the 'Fonts' folder
"shellnew"  the new documents template folder
"program files"  the program files folder
"common files"  the common folder in the program files folder
"profile" the users profile folder
"music" the users My Music folder
"video" the users My Videos folder
"pictures" the users My Pictures folder
"appdata" the users Application Data folder
"local appdata" the users Local Application Data
"program data" the Program Data folder
"public" the Public folder (Vista only)
"users" the 'Users' folder (Vista only)



"system"  the System Folder
"prefs"  the Preferences folder
"temp"  the Temporary Items folder on the startup disk
"desktop"  the Desktop folder on the startup disk
"trash"  the trash can
"startup"  the Startup Items folder
"apple"  the Apple Menu Items folder
"control panels"  the Control Panels folder
"extensions"  the Extensions folder
"fonts"  the Fonts folder
"boot"  the name of the start up disk
"personal"  the users personal documents folder
"apps"  The applications folder
"favorites"  the users favorites folder
"music" the users Music folder
"video" the users Videos folder
"pictures" the users Pictures folder
"appdata" the Application Support folder
"library" the Library folder
"shared" a shared folder readable and writeable for all users
"profile' the users profile folder
"users" the 'Users' folder
"public" the Public folder


Returns the requested folder.


WinDir = baSysFolder( "windows" )

WinDir := baSysFolder( "windows" )


The string that is returned will always end with a folder separator.

On Windows, as well as the above folders, you can also pass in the number of a special folder. These numbers are listed in the ShlObj.h header file in the Windows Platform SDK. For example, to get the Cookies folder, you can use baSysFolder( "33" ). If you pass in a number, it will be passed directly to the SHGetSpecialFolderLocation API call. The numbers in the header file are listed n hex, you will need to convert them to decimal to use this function.

On Macintosh, you can also use a four character code to find other folders. For example, you can use baSysFolder( “laun” ) to find the Launcher Items folder. You can find a list of the possible folder codes in the <Folders.h> programming header file in the Universal Headers available from Apple. Not all of the listed folders will be available on all systems or under all Mac OS versions.

On Macintosh, the folders exist in domains - User, Local or System. This function attempts to find the most appropriate domain for the folder. To explicitly search in a particular domain, add "user", "local" or "system" to the folder name. For example:

put baSysFolder( "libary" )
-- "/Library"

put baSysFolder( "system library" )
-- "/System/Library"

Not all folders will exist in all domains.