Macaulay2 » Documentation
Packages » Macaulay2Doc » The Macaulay2 language » Core » how Macaulay2 finds its files » applicationDirectory
next | previous | forward | backward | up | index | toc

# applicationDirectory -- the path to the user's application directory

- Usage:
    `applicationDirectory()`
- Outputs:
  - a string, the path to the user's application directory

## Description

The function installPackage, by default, installs packages under the application directory. At program startup, unless the -q option is provided on the command line, an entry will be added to the path so packages can be loaded from there by loadPackage and needsPackage. Moreover, the initialization file, if found there, will be run.

The function applicationDirectorySuffix determines the value of applicationDirectory, and can be modified by the user.

    i1 : applicationDirectory()

    o1 = /home/m2user/.Macaulay2/

## Code

    /usr/share/Macaulay2/Core/startup.m2:221:28-231:11: --source code:
         applicationDirectory = () -> (
              if getenv "HOME" =!= ""
              then (
                   getenv "HOME" | "/" |
                   -- we allow the user to change applicationDirectorySuffix to a string or a function
                   if instance(applicationDirectorySuffix, Function)
                   then applicationDirectorySuffix()
                   else applicationDirectorySuffix
                   )
              else error "environment variable HOME not set"
              );

## See also

- applicationDirectorySuffix -- suffix that determines the user's application directory

## For the programmer

The object applicationDirectory is a function closure.

The source of this document is in /build/macaulay2-88fgJW/macaulay2-1.25.11+ds/M2/Macaulay2/packages/Macaulay2Doc/ov_system.m2:1836:0.