6.8 API for Finding Installation Directories

► |  | raco: Racket Command-Line Tools

1 | raco make: Compiling Source to Bytecode
2 | raco exe: Creating Stand-Alone Executables
3 | raco distribute: Sharing Stand-Alone Executables
4 | raco planet: Automatic Package Distribution
5 | raco pkg: Package Management
6 | raco setup: Installation Management
7 | raco decompile: Decompiling Bytecode
8 | raco demod: Demodularizing Programs
9 | raco link: Library Collection Links
10 | raco pack: Packing Library Collections
11 | raco unpack: Unpacking Library Collections
12 | raco ctool: Working with C Code
13 | raco test: Run tests
14 | raco docs: Documentation Search
15 | raco expand: Macro Expansion
16 | raco read: Reading and Pretty-Printing
17 | raco scribble: Building Documentation
18 | Adding a raco Command
19 | Installation Configuration and Search Paths

▼ | 6 | raco setup: Installation Management

6.1 | Running raco setup
6.2 | Installing ".plt" Archives
6.3 | Controlling raco setup with "info.rkt" Files
6.4 | "info.rkt" File Format
6.5 | Package Dependency Checking
6.6 | API for Setup
6.7 | API for Installing ".plt" Archives
6.8 | API for Finding Installation Directories
6.9 | API for Reading "info.rkt" Files
6.10 | API for Relative Paths
6.11 | API for Collection Names
6.12 | API for Collection Searches
6.13 | API for Platform Specifications
6.14 | API for Cross-Platform Configuration
6.15 | API for Cross-References for Installed Manuals
6.16 | API for Materializing User-Specific Documentation

On this page:

find-collects-dir
find-user-collects-dir
get-collects-search-dirs
get-main-collects-search-dirs
find-config-dir
find-links-file
find-user-links-file
get-links-search-files
find-pkgs-dir
find-user-pkgs-dir
get-pkgs-search-dirs
find-doc-dir
find-user-doc-dir
get-doc-search-dirs
find-lib-dir
find-user-lib-dir
get-lib-search-dirs
find-dll-dir
find-share-dir
find-user-share-dir
find-include-dir
find-user-include-dir
get-include-search-dirs
find-console-bin-dir
find-gui-bin-dir
find-user-console-bin-dir
find-user-gui-bin-dir
find-apps-dir
find-user-apps-dir
find-man-dir
find-user-man-dir
get-doc-search-url
get-doc-open-url
get-installation-name
get-build-stamp
get-absolute-installation?

top ← prev up next →

#### 6.8`` API for Finding Installation Directories

(require setup/dirs) | package: base

The setup/dirs library provides several procedures for locating installation directories:

> procedure (find-collects-dir) → (or/c path? #f)

Returns a path to the installation’s main "collects" directory, or #f if none can be found. A #f result is likely only in a stand-alone executable that is distributed without libraries.

> procedure (find-user-collects-dir) → path?

Returns a path to the user-specific "collects" directory; the directory indicated by the returned path may or may not exist.

> procedure (get-collects-search-dirs) → (listof path?)

Returns the same result as (current-library-collection-paths), which means that this result is not sensitive to the value of the use-user-specific-search-paths parameter.

> procedure (get-main-collects-search-dirs) → (listof path?)

Returns a list of paths to installation "collects" directories, including the result of find-collects-dir. These directories are normally included in the result of (current-library-collection-paths), but a PLTCOLLECTS setting or change to the parameter may cause them to be omitted. Any other path in (current-library-collection-paths) is treated as user-specific. The directories indicated by the returned paths may or may not exist.

> procedure (find-config-dir) → (or/c path? #f)

Returns a path to the installation’s "etc" directory, which contains configuration and package information—including configuration of some of the other directories (see Installation Configuration and Search Paths). A #f result indicates that no configuration directory is available.

> procedure (find-links-file) → path?

Returns a path to the installation’s collection links file. The file indicated by the returned path may or may not exist.

> procedure (find-user-links-file [vers]) → path?
> vers : string? = (get-installation-name)

Returns a path to the user’s collection links file. The file indicated by the returned path may or may not exist.

> procedure (get-links-search-files) → path?

Returns a list of paths to installation collection links files that are search in order. (Normally, the result includes the result of (find-links-file), which is where new installation-wide links are installed by raco link or links.) The files indicated by the returned paths may or may not exist.

> procedure (find-pkgs-dir) → path?

Returns a path to the directory containing packages with installation scope; the directory indicated by the returned path may or may not exist.

> procedure (find-user-pkgs-dir [vers]) → path?
> vers : string? = (get-installation-name)

Returns a path to the directory containing packages with user-specific scope for installation name vers; the directory indicated by the returned path may or may not exist.

> procedure (get-pkgs-search-dirs) → (listof path?)

Returns a list of paths to the directories containing packages in installation scope. (Normally, the result includes the result of (find-pkgs-dir), which is where new packages are installed by raco pkg install.) The directories indicated by the returned paths may or may not exist.

> procedure (find-doc-dir) → (or/c path? #f)

Returns a path to the installation’s "doc" directory. The result is #f if no such directory is available.

> procedure (find-user-doc-dir) → path?

Returns a path to a user-specific "doc" directory. The directory indicated by the returned path may or may not exist.

> procedure (get-doc-search-dirs) → (listof path?)

Returns a list of paths to search for documentation, not including documentation stored in individual collections. Unless it is configured otherwise, the result includes any non-#f result of (find-doc-dir) and (find-user-doc-dir)—but the latter is included only if the value of the use-user-specific-search-paths parameter is #t.

> procedure (find-lib-dir) → (or/c path? #f)

Returns a path to the installation’s "lib" directory, which contains libraries and other build information. The result is #f if no such directory is available.

> procedure (find-user-lib-dir) → path?

Returns a path to a user-specific "lib" directory; the directory indicated by the returned path may or may not exist.

> procedure (get-lib-search-dirs) → (listof path?)

Returns a list of paths to search for foreign libraries. Unless it is configured otherwise, the result includes any non-#f result of (find-lib-dir) and (find-user-lib-dir)—but the latter is included only if the value of the use-user-specific-search-paths parameter is #t.

Changed in version 6.1.1.4 of package base: Dropped (find-dll-dir) from the set of paths to explicitly include in the default.

> procedure (find-dll-dir) → (or/c path? #f)

Returns a path to the directory that contains DLLs for use with the current executable (e.g., "libracket.dll" on Windows). The result is #f if no such directory is available, or if no specific directory is available (i.e., other than the platform’s normal search path).

> procedure (find-share-dir) → (or/c path? #f)

Returns a path to the installation’s "share" directory, which contains installed packages and other platform-independent files. The result is #f if no such directory is available.

> procedure (find-user-share-dir) → path?

Returns a path to a user-specific "share" directory; the directory indicated by the returned path may or may not exist.

> procedure (find-include-dir) → (or/c path? #f)

Returns a path to the installation’s "include" directory, which contains ".h" files for building Racket extensions and embedding programs. The result is #f if no such directory is available.

> procedure (find-user-include-dir) → path?

Returns a path to a user-specific "include" directory; the directory indicated by the returned path may or may not exist.

> procedure (get-include-search-dirs) → (listof path?)

Returns a list of paths to search for ".h" files. Unless it is configured otherwise, the result includes any non-#f result of (find-include-dir) and (find-user-include-dir)—but the latter is included only if the value of the use-user-specific-search-paths parameter is #t.

> procedure (find-console-bin-dir) → (or/c path? #f)

Returns a path to the installation’s executable directory, where the stand-alone Racket executable resides. The result is #f if no such directory is available.

> procedure (find-gui-bin-dir) → (or/c path? #f)

Returns a path to the installation’s executable directory, where the stand-alone GRacket executable resides. The result is #f if no such directory is available.

> procedure (find-user-console-bin-dir) → path?

Returns a path to the user’s executable directory; the directory indicated by the returned path may or may not exist.

> procedure (find-user-gui-bin-dir) → path?

Returns a path to the user’s executable directory for graphical programs; the directory indicated by the returned path may or may not exist.

> procedure (find-apps-dir) → (or/c path? #f)

Returns a path to the installation’s directory ".desktop" files (for Unix). The result is #f if no such directory exists.

> procedure (find-user-apps-dir) → path?

Returns a path to the user’s directory for ".desktop" files (for Unix); the directory indicated by the returned path may or may not exist.

> procedure (find-man-dir) → (or/c path? #f)

Returns a path to the installation’s man-page directory. The result is #f if no such directory exists.

> procedure (find-user-man-dir) → path?

Returns a path to the user’s man-page directory; the directory indicated by the returned path may or may not exist.

> procedure (get-doc-search-url) → string?

Returns a string that is used by the documentation system, augmented with a version and search-key query, for remote documentation links.

> procedure (get-doc-open-url) → (or/c string? #f)

Returns #f or a string for a root URL to be used as an alternative to opening a local file for documentation. A non-#f configuration means that DrRacket, for example, performs keyword searches for documentation via the specified URL instead of from locally installed documentation.

Added in version 6.0.1.6 of package base.

> procedure (get-installation-name) → string?

Returns the current installation’s name, which is often (version) but can be configured via 'installation-name in "config.rktd" (see Installation Configuration and Search Paths).

> procedure (get-build-stamp) → (or/c #f string?)

Returns a string that identifies an installation build, which can be used to augment the Racket version number to more specifically identify the build. An empty string is normally produced for a release build. The result is #f if no build stamp is available.

> procedure (get-absolute-installation?) → boolean?

Returns #t if this installation uses absolute path names for executable and library references, #f otherwise.
top ← prev up next →