HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Moduledirectory-1.3.8.5Haskell2010

System.Directory.Internal

Internal modules are always subject to change from version to version. The contents of this module are also platform-dependent, hence what is shown in the Hackage documentation may differ from what is actually available on your system.

  • 9 types
  • 79 values
  • Packagedirectory-1.3.8.5
  • Exports88
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceInternal.hs
datadata FileType
#

Constructors

Instances6Bounded, Enum, Eq, Ord, Read, Show
  • Bounded FileTypeDefined in directory-1.3.8.5 · System.Directory.Internal.Common
  • Enum FileTypeDefined in directory-1.3.8.5 · System.Directory.Internal.Common
  • Eq FileTypeDefined in directory-1.3.8.5 · System.Directory.Internal.Common
  • Ord FileTypeDefined in directory-1.3.8.5 · System.Directory.Internal.Common
  • Read FileTypeDefined in directory-1.3.8.5 · System.Directory.Internal.Common
  • Show FileTypeDefined in directory-1.3.8.5 · System.Directory.Internal.Common
datadata XdgDirectory
#

Special directories for storing user-specific application data, configuration, and cache files, as specified by the XDG Base Directory Specification.

Note: On Windows, XdgData and XdgConfig usually map to the same directory.

Constructors

  • XdgData

    For data files (e.g. images). It uses the XDG_DATA_HOME environment variable. On non-Windows systems, the default is ~/.local/share. On Windows, the default is %APPDATA% (e.g. C:/Users/<user>/AppData/Roaming). Can be considered as the user-specific equivalent of /usr/share.

  • XdgConfig

    For configuration files. It uses the XDG_CONFIG_HOME environment variable. On non-Windows systems, the default is ~/.config. On Windows, the default is %APPDATA% (e.g. C:/Users/<user>/AppData/Roaming). Can be considered as the user-specific equivalent of /etc.

  • XdgCache

    For non-essential files (e.g. cache). It uses the XDG_CACHE_HOME environment variable. On non-Windows systems, the default is ~/.cache. On Windows, the default is %LOCALAPPDATA% (e.g. C:/Users/<user>/AppData/Local). Can be considered as the user-specific equivalent of /var/cache.

  • XdgState

    For data that should persist between (application) restarts, but that is not important or portable enough to the user that it should be stored in XdgData. It uses the XDG_STATE_HOME environment variable. On non-Windows sytems, the default is ~/.local/state. On Windows, the default is %LOCALAPPDATA% (e.g. C:/Users/<user>/AppData/Local).

Instances6Bounded, Enum, Eq, Ord, Read, Show
  • Bounded XdgDirectoryDefined in directory-1.3.8.5 · System.Directory.Internal.Common
  • Enum XdgDirectoryDefined in directory-1.3.8.5 · System.Directory.Internal.Common
  • Eq XdgDirectoryDefined in directory-1.3.8.5 · System.Directory.Internal.Common
  • Ord XdgDirectoryDefined in directory-1.3.8.5 · System.Directory.Internal.Common
  • Read XdgDirectoryDefined in directory-1.3.8.5 · System.Directory.Internal.Common
  • Show XdgDirectoryDefined in directory-1.3.8.5 · System.Directory.Internal.Common
datadata XdgDirectoryList
#

Search paths for various application data, as specified by the XDG Base Directory Specification.

The list of paths is split using System.FilePath.searchPathSeparator, which on Windows is a semicolon.

Note: On Windows, XdgDataDirs and XdgConfigDirs usually yield the same result.

Constructors

  • XdgDataDirs

    For data files (e.g. images). It uses the XDG_DATA_DIRS environment variable. On non-Windows systems, the default is /usr/local/share/ and /usr/share/. On Windows, the default is %PROGRAMDATA% or %ALLUSERSPROFILE% (e.g. C:/ProgramData).

  • XdgConfigDirs

    For configuration files. It uses the XDG_CONFIG_DIRS environment variable. On non-Windows systems, the default is /etc/xdg. On Windows, the default is %PROGRAMDATA% or %ALLUSERSPROFILE% (e.g. C:/ProgramData).

Instances6Bounded, Enum, Eq, Ord, Read, Show
valueexpandDots :: [OsPath] -> [OsPath]
#

Given a list of path segments, expand . and ... The path segments must not contain path separators.

valueignoreIOExceptions :: IO () -> IO ()
#

Attempt to perform the given action, silencing any IO exception thrown by it.

valueos :: String -> OsString
#

Fallibly converts String to OsString. Only intended to be used on literals.

Similar to normalise but:

  • empty paths stay empty,

  • parent dirs (..) are expanded, and

  • paths starting with \\?\ are preserved.

The goal is to preserve the meaning of paths better than normalise.

valueso :: OsString -> String
#

Fallibly converts OsString to String. Only intended to be used on literals.

typetype OsPath = OsString
#

Type representing filenames/pathnames.

This type doesn't add any guarantees over OsString.

newtypenewtype OsString
#

Newtype representing short operating system specific strings.

Internally this is either WindowsString or PosixString, depending on the platform. Both use unpinned ShortByteString for efficiency.

The constructor is only exported via System.OsString.Internal.Types, since dealing with the internals isn't generally recommended, but supported in case you need to write platform specific code.

Instances9Eq, Ord, Show, Generic, Semigroup, Monoid, …
valuecopyFileContents
  1. :: OsPath

    Source filename

  2. -> OsPath

    Destination filename

  3. -> IO ()
#

Truncate the destination file and then copy the contents of the source file to the destination file. If the destination file already exists, its attributes shall remain unchanged. Otherwise, its attributes are reset to the defaults.

$HOME is preferred, because the user has control over it. However, POSIX doesn't define it as a mandatory variable, so fall back to getpwuid_r.

valuegetPath :: IO [OsPath]
#

Get the contents of the PATH environment variable.

Convert a path into an absolute path. If the given path is relative, the current directory is prepended and the path may or may not be simplified. If the path is already absolute, the path is returned unchanged. The function preserves the presence or absence of the trailing path separator.

If the path is already absolute, the operation never fails. Otherwise, the operation may throw exceptions.

Empty paths are treated as the current directory.