mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-08 14:03:23 +00:00
add getDataDir to std/appdirs.nim (#21754)
* add getDataDir to std/appdirs.nim * reuse `osappdirs.getDataDir` * Update lib/std/appdirs.nim --------- Co-authored-by: ringabout <43030857+ringabout@users.noreply.github.com>
This commit is contained in:
@@ -17,6 +17,23 @@ proc getHomeDir*(): Path {.inline, tags: [ReadEnvEffect, ReadIOEffect].} =
|
||||
## * `getTempDir proc`_
|
||||
result = Path(osappdirs.getHomeDir())
|
||||
|
||||
proc getDataDir*(): Path {.inline, tags: [ReadEnvEffect, ReadIOEffect].} =
|
||||
## Returns the data directory of the current user for applications.
|
||||
##
|
||||
## On non-Windows OSs, this proc conforms to the XDG Base Directory
|
||||
## spec. Thus, this proc returns the value of the `XDG_DATA_HOME` environment
|
||||
## variable if it is set, otherwise it returns the default configuration
|
||||
## directory ("~/.local/share" or "~/Library/Application Support" on macOS).
|
||||
##
|
||||
## See also:
|
||||
## * `getHomeDir proc`_
|
||||
## * `getConfigDir proc`_
|
||||
## * `getTempDir proc`_
|
||||
## * `expandTilde proc`_
|
||||
## * `getCurrentDir proc`_
|
||||
## * `setCurrentDir proc`_
|
||||
result = Path(osappdirs.getDataDir())
|
||||
|
||||
proc getConfigDir*(): Path {.inline, tags: [ReadEnvEffect, ReadIOEffect].} =
|
||||
## Returns the config directory of the current user for applications.
|
||||
##
|
||||
|
||||
Reference in New Issue
Block a user