Purpose
Returns the path of a special MapInfo Pro or Windows directory. You can call this function from the MapBasic window in MapInfo Pro.
Syntax
GetFolderPath$( folder_id )
folder_id is one of the following values:
FOLDER_MI_APPDATA (-1)
FOLDER_MI_LOCAL_APPDATA (-2)
FOLDER_MI_PREFERENCE (-3)
FOLDER_MI_COMMON_APPDATA (-4)
FOLDER_APPDATA (26)
FOLDER_LOCAL_APPDATA (28)
FOLDER_COMMON_APPDATA (35)
FOLDER_COMMON_DOCS (46)
FOLDER_MYDOCS (5)
FOLDER_MYPICS (39)
Return Value
String
Description
Given the ID of a special MapInfo or Windows directory, GetFolderPath$() function returns the path of the directory. An example of a special Windows directory is the My Documents directory. An example of a special MapInfo directory is the preference directory; the default location to which MapInfo Pro writes out the preference file.
The location of many of these directories varies between versions of Windows. They can also vary depending on which user is logged in. Note that FOLDER_MI_APPDATA (-1), FOLDER_MI_LOCAL_APPDATA (-2), and FOLDER_MI_COMMON_APPDATA (-4) may not exist. Before attempting to access those directories, test for their existence by using FileExists() function. FOLDER_MI_PREFERENCE (-3) always exists.
IDs beginning in FOLDER_MI return the path for directories specific to MapInfo Pro. The rest of the IDs return the path for Windows directories and correspond to the IDs defined for WIN32 API function SHGetFolderPath. The most common of these IDs have been defined for easy use in MapBasic applications. Any ID valid to SHGetFolderPath will work with GetFolderPath$().
Example
include "mapbasic.def"
declare sub main
sub main
dim sMiPrfFile as string
sMiPrfFile = GetFolderPath$(FOLDER_MI_PREFERENCE)
Print sMiPrfFile
end subet128
See Also:
LocateFile$() function