mirror of
https://github.com/NixOS/nix
synced 2025-07-02 17:41:48 +02:00
nix repl: Use $XDG_DATA_HOME for the readline history
This commit is contained in:
parent
921a2aeb05
commit
5bd8795e1f
3 changed files with 19 additions and 3 deletions
|
@ -441,6 +441,18 @@ Path getConfigDir()
|
|||
}
|
||||
|
||||
|
||||
Path getDataDir()
|
||||
{
|
||||
Path dataDir = getEnv("XDG_DATA_HOME");
|
||||
if (dataDir.empty()) {
|
||||
Path homeDir = getEnv("HOME");
|
||||
if (homeDir.empty()) throw Error("$XDG_DATA_HOME and $HOME are not set");
|
||||
dataDir = homeDir + "/.local/share";
|
||||
}
|
||||
return dataDir;
|
||||
}
|
||||
|
||||
|
||||
Paths createDirs(const Path & path)
|
||||
{
|
||||
Paths created;
|
||||
|
|
|
@ -116,6 +116,9 @@ Path getCacheDir();
|
|||
/* Return $XDG_CONFIG_HOME or $HOME/.config. */
|
||||
Path getConfigDir();
|
||||
|
||||
/* Return $XDG_DATA_HOME or $HOME/.local/share. */
|
||||
Path getDataDir();
|
||||
|
||||
/* Create a directory and all its parents, if necessary. Returns the
|
||||
list of created directories, in order of creation. */
|
||||
Paths createDirs(const Path & path);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue