Arbortext Command Language > Functions by Alphabetical Listing > get_custom_dir
  
get_custom_dir
get_custom_dir ([app_or_index])
The get_custom_dir function returns the full path of the directory in which a given application is installed. An application is not required to be installed inside the Arbortext Editor or Arbortext Publishing Engine install tree, as long as you use the APTAPPLICATION or APTCUSTOM environment variable to specify another path or path list to search for custom applications (using a file system specification for APTAPPLICATION; HTTP references are not supported).
In cases where APTCUSTOM cites a zipped custom directory, application, or CMS adapter, get_custom_directory returns a full path to the locally expanded form of the zipped customization. The expanded form is stored in the Arbortext Editor cache (.aptcache\zc) directory. For example, if APTCUSTOM is set to the following value:
http://server/apps/custom.zip
The get_custom_directory function returns a path similar to the following value:
C:\Documents and Settings\user\Local Settings\
Application Data\PTC\Arbortext\Editor\.aptcache\zc\1
If APTCUSTOM points to a zipped application called com.acme.app and is set to the following value:
http://server/apps/app.zip
The get_custom_directory(com.acme.app) function returns a path similar to the following value:
C:\Documents and Settings\user\Local Settings\
Application Data\PTC\Arbortext\Editor\.aptcache\zc\3\com.acme.app
The app_or_index parameter is optional; if omitted, 0 is assumed. If specified, it can be one of the following:
The application's uniquely named directory (usually a Java class name, such as com.arbortext.sample).
The function returns the full path of the directory containing the given application. An empty string is returned if no matching application is found.
Example:
local dir = get_custom_dir("com.arbortext.sample");
An integer greater than or equal to zero.
The function returns the full path of the custom or application directory corresponding to the integer specified. The function follows the search order of the custom and application directory path list determined when Arbortext Editor or the Arbortext Publishing Engine starts. For example, the order would be 0 for the first directory in the search order list, 1 for the next directory, and so on. This function returns an empty string for an index that is out of range.
The search path is built at startup from any custom directories as well as any applications loaded from the application directory.
Example:
local i;
local dir;
for (i = 0; dir = get_custom_dir(i); i++) {
# Do something with the directory here.
}
A negative integer.
The function returns the full path of the custom or application directory corresponding to the integer specified. The function reverses the search order of the custom and application directory path list determined when Arbortext Editor or the Arbortext Publishing Engine starts. For example, the order would be -1 for the last directory in the search order list, -2 for the next to last directory, and so on. This function returns an empty string for an index that is out of range.
The search path is built at startup from any custom directories as well as any applications loaded from the application directory.
Example:
local i;
local dir;
for (i = -1; dir = get_custom_dir(i); i--) {
# Do something with the directory here.
}
Related Topics
Cache directory (.aptcache)
get_custom_property function
get_user_property function
application_name function