LocateFile$() function - MapBasic - 2023

MapInfo MapBasic Reference

Product type
Software
Portfolio
Locate
Product family
MapInfo
Product
MapInfo > MapBasic
Version
2023
Language
English
Product name
MapBasic
Title
MapInfo MapBasic Reference
First publish date
1985
Last updated
2023-09-12
Published on
2023-09-12T16:32:32.686312

Purpose

Return the path to one of the MapInfo application data files. You can call this function from the MapBasic window in MapInfo Pro.

Syntax

LocateFile$( file_id )

file_id is one of the following values

Value ID Description
LOCATE_PREF_FILE 0 Preference file (MAPINFOW.PRF).
LOCATE_DEF_WOR 1 Default workspace file (MAPINFOW.WOR).
LOCATE_CLR_FILE 2 Color file (MAPINFOW.CLR).
LOCATE_PEN_FILE 3 Pen file (MAPINFOW.PEN).
LOCATE_FNT_FILE 4 Symbol file (MAPINFOW.FNT).
LOCATE_ABB_FILE 5 Abbreviation file (MAPINFOW.ABB).
LOCATE_PRJ_FILE 6 Projection file (MAPINFOW.PRJ).
LOCATE_MNU_FILE 7 Menu file (MAPINFOW.MNU).
LOCATE_CUSTSYMB_DIR 8 Custom symbol directory (CUSTSYMB).
LOCATE_THMTMPLT_DIR 9 Theme template directory (THMTMPL).
LOCATE_GRAPH_DIR 10 Graph support directory (GRAPHSUPPORT).
LOCATE_WMS_SERVERLIST 11 XML list of WMS servers (MIWMSSERVERS.XML).
LOCATE_WFS_SERVERLIST 12 XML list of WFS servers (MIWFSSERVERS.XML).
LOCATE_GEOCODE_SERVERLIST 13 XML list of geocode servers (MIGEOCODESERVERS.XML).
LOCATE_ROUTING_SERVERLIST 14 XML list of routing servers (MIROUTINGSERVERS.XML).
LOCATE_LAYOUT_TEMPLATE_DIR 15 Layout template directory (LAYOUTTEMPLATE)

Return Value

String

Description

Given the ID of a MapInfo Pro application data file, this function returns the location where MapInfo Pro found that file. MapInfo Pro installs these files under the user's Application Data directory, but there are several valid locations for these files, including the program directory. MapBasic applications should not assume the location of these files, instead LocateFile$() should be used to determine the actual location.

Example

include "mapbasic.def"
declare sub main
sub main
dim sGraphLocations as string
sGraphLocations = LocateFile$(LOCATE_GRAPH_DIR)
Print sGraphLocations
end sub

See Also:

GetFolderPath$() function