Xdg.Directories/api/Xdg.Directories.BaseDirectory.html
2024-07-10 19:39:30 +00:00

505 lines
22 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Class BaseDirectory </title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="title" content="Class BaseDirectory ">
<meta name="description" content="The XDG Base Directory specification is a standard created by freedesktop.org that standardizes the location of storing application files.">
<link rel="icon" href="../images/icon.png">
<link rel="stylesheet" href="../public/docfx.min.css">
<link rel="stylesheet" href="../public/main.css">
<meta name="docfx:navrel" content="../toc.html">
<meta name="docfx:tocrel" content="toc.html">
<meta name="docfx:rel" content="../">
<meta name="docfx:docurl" content="https://github.com/xdg-net/Xdg.Directories/new/master/apiSpec/new?filename=Xdg_Directories_BaseDirectory.md&amp;value=---%0Auid%3A%20Xdg.Directories.BaseDirectory%0Asummary%3A%20&#39;*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax&#39;%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">
<meta name="loc:inThisArticle" content="In this article">
<meta name="loc:searchResultsCount" content="{count} results for &quot;{query}&quot;">
<meta name="loc:searchNoResults" content="No results for &quot;{query}&quot;">
<meta name="loc:tocFilter" content="Filter by title">
<meta name="loc:nextArticle" content="Next">
<meta name="loc:prevArticle" content="Previous">
<meta name="loc:themeLight" content="Light">
<meta name="loc:themeDark" content="Dark">
<meta name="loc:themeAuto" content="Auto">
<meta name="loc:changeTheme" content="Change theme">
<meta name="loc:copy" content="Copy">
<meta name="loc:downloadPdf" content="Download PDF">
<script type="module" src="./../public/docfx.min.js"></script>
<script>
const theme = localStorage.getItem('theme') || 'auto'
document.documentElement.setAttribute('data-bs-theme', theme === 'auto' ? (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light') : theme)
</script>
</head>
<body class="tex2jax_ignore" data-layout="" data-yaml-mime="ManagedReference">
<header class="bg-body border-bottom">
<nav id="autocollapse" class="navbar navbar-expand-md" role="navigation">
<div class="container-xxl flex-nowrap">
<a class="navbar-brand" href="../index.html">
<img id="logo" class="svg" src="../images/icon.svg" alt="Xdg.Directories">
Xdg.Directories
</a>
<button class="btn btn-lg d-md-none border-0" type="button" data-bs-toggle="collapse" data-bs-target="#navpanel" aria-controls="navpanel" aria-expanded="false" aria-label="Toggle navigation">
<i class="bi bi-three-dots"></i>
</button>
<div class="collapse navbar-collapse" id="navpanel">
<div id="navbar">
<form class="search" role="search" id="search">
<i class="bi bi-search"></i>
<input class="form-control" id="search-query" type="search" disabled="" placeholder="Search" autocomplete="off" aria-label="Search">
</form>
</div>
</div>
</div>
</nav>
</header>
<main class="container-xxl">
<div class="toc-offcanvas">
<div class="offcanvas-md offcanvas-start" tabindex="-1" id="tocOffcanvas" aria-labelledby="tocOffcanvasLabel">
<div class="offcanvas-header">
<h5 class="offcanvas-title" id="tocOffcanvasLabel">Table of Contents</h5>
<button type="button" class="btn-close" data-bs-dismiss="offcanvas" data-bs-target="#tocOffcanvas" aria-label="Close"></button>
</div>
<div class="offcanvas-body">
<nav class="toc" id="toc"></nav>
</div>
</div>
</div>
<div class="content">
<div class="actionbar">
<button class="btn btn-lg border-0 d-md-none" type="button" data-bs-toggle="offcanvas" data-bs-target="#tocOffcanvas" aria-controls="tocOffcanvas" aria-expanded="false" aria-label="Show table of contents">
<i class="bi bi-list"></i>
</button>
<nav id="breadcrumb"></nav>
</div>
<article data-uid="Xdg.Directories.BaseDirectory">
<h1 id="Xdg_Directories_BaseDirectory" data-uid="Xdg.Directories.BaseDirectory" class="text-break">
Class BaseDirectory <a class="header-action link-secondary" title="View source" href="https://github.com/xdg-net/Xdg.Directories/blob/master/src/Xdg.Directories/BaseDirectory.cs/#L4"><i class="bi bi-code-slash"></i></a>
</h1>
<div class="facts text-secondary">
<dl><dt>Namespace</dt><dd><a class="xref" href="Xdg.html">Xdg</a>.<a class="xref" href="Xdg.Directories.html">Directories</a></dd></dl>
<dl><dt>Assembly</dt><dd>Xdg.Directories.dll</dd></dl>
</div>
<div class="markdown summary"><p>The XDG Base Directory specification is a standard created by freedesktop.org that standardizes the location of storing application files.</p>
</div>
<div class="markdown conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static class BaseDirectory</code></pre>
</div>
<dl class="typelist inheritance">
<dt>Inheritance</dt>
<dd>
<div><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object">object</a></div>
<div><span class="xref">BaseDirectory</span></div>
</dd>
</dl>
<dl class="typelist inheritedMembers">
<dt>Inherited Members</dt>
<dd>
<div>
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object)">object.Equals(object)</a>
</div>
<div>
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)">object.Equals(object, object)</a>
</div>
<div>
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.gethashcode">object.GetHashCode()</a>
</div>
<div>
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.gettype">object.GetType()</a>
</div>
<div>
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone">object.MemberwiseClone()</a>
</div>
<div>
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.referenceequals">object.ReferenceEquals(object, object)</a>
</div>
<div>
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.tostring">object.ToString()</a>
</div>
</dd></dl>
<h2 id="Xdg_Directories_BaseDirectory_remarks">Remarks</h2>
<div class="markdown level0 remarks"> <p>
<br>
This allows users to have less clutter in their home directories, and allows programmers to not have to hard-code directories.
</p>
<br>
For all base directories, the directories are resolved as follows:
<ol><li><span class="term">
The respective <code>XDG_*</code> enivronment variable
</span>will always be used if specified</li><li><table><tbody><tr></tr><tr><td class="term">Windows</td><td class="description">
Use <a href="https://learn.microsoft.com/en-us/windows/win32/shell/known-folders">Known Folders</a>.
</td></tr><tr><td class="term">macOS</td><td class="description">
Follow the <a href="https://developer.apple.com/library/archive/documentation/FileManagement/Conceptual/FileSystemProgrammingGuide/FileSystemOverview/FileSystemOverview.html#//apple_ref/doc/uid/TP40010672-CH2-SW1">Apple documentation</a> on application-specific files.
</td></tr><tr><td class="term">Linux/FreeBSD</td><td class="description">
Follow the <a href="https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html">XDG Base Directory</a> specification.
</td></tr></tbody></table></li></ol>
</div>
<h2 class="section" id="properties">Properties
</h2>
<a id="Xdg_Directories_BaseDirectory_BinHome_" data-uid="Xdg.Directories.BaseDirectory.BinHome*"></a>
<h3 id="Xdg_Directories_BaseDirectory_BinHome" data-uid="Xdg.Directories.BaseDirectory.BinHome">
BinHome
<a class="header-action link-secondary" title="View source" href="https://github.com/xdg-net/Xdg.Directories/blob/master/src/Xdg.Directories/BaseDirectory.cs/#L55"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>Base directory for executable files.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static string BinHome { get; }</code></pre>
</div>
<h4 class="section">Property Value</h4>
<dl class="parameters">
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
<dd><p>A single base directory relative to which user-specifc <strong>executable</strong> files should be written.</p>
</dd>
</dl>
<h4 class="section" id="Xdg_Directories_BaseDirectory_BinHome_remarks">Remarks</h4>
<div class="markdown level1 remarks"><p>If <code>XDG_BIN_HOME</code> is set, the directory specified.</p>
<table><tbody><tr><td class="term">Windows</td><td class="description"><code>""</code><br>
Windows does not support this by default.
</td></tr><tr><td class="term">macOS</td><td class="description"><code>""</code><br>
macOS does not support this by default.
</td></tr><tr><td class="term">Linux/FreeBSD</td><td class="description"><code>$HOME/.local/bin</code></td></tr></tbody></table>
NOTE: This is not an XDG standard but a <em>de facto</em> standard.
</div>
<a id="Xdg_Directories_BaseDirectory_CacheHome_" data-uid="Xdg.Directories.BaseDirectory.CacheHome*"></a>
<h3 id="Xdg_Directories_BaseDirectory_CacheHome" data-uid="Xdg.Directories.BaseDirectory.CacheHome">
CacheHome
<a class="header-action link-secondary" title="View source" href="https://github.com/xdg-net/Xdg.Directories/blob/master/src/Xdg.Directories/BaseDirectory.cs/#L117"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>Base directory for non-essential data.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static string CacheHome { get; }</code></pre>
</div>
<h4 class="section">Property Value</h4>
<dl class="parameters">
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
<dd><p>A single base directory relative to which user-specifc <strong>non-essential</strong> data should be written.</p>
</dd>
</dl>
<h4 class="section" id="Xdg_Directories_BaseDirectory_CacheHome_remarks">Remarks</h4>
<div class="markdown level1 remarks"><p>If <code>XDG_CACHE_HOME</code> is set, the directory specified.</p>
<table><tbody><tr><td class="term">Windows</td><td class="description"><code>%LOCALAPPDATA%\cache</code></td></tr><tr><td class="term">macOS</td><td class="description"><code>$HOME/Library/Caches</code></td></tr><tr><td class="term">Linux/FreeBSD</td><td class="description"><code>$HOME/.cache</code></td></tr></tbody></table>
</div>
<a id="Xdg_Directories_BaseDirectory_ConfigDirs_" data-uid="Xdg.Directories.BaseDirectory.ConfigDirs*"></a>
<h3 id="Xdg_Directories_BaseDirectory_ConfigDirs" data-uid="Xdg.Directories.BaseDirectory.ConfigDirs">
ConfigDirs
<a class="header-action link-secondary" title="View source" href="https://github.com/xdg-net/Xdg.Directories/blob/master/src/Xdg.Directories/BaseDirectory.cs/#L90"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>A list of directories to look for configuration files.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static IList&lt;string&gt; ConfigDirs { get; }</code></pre>
</div>
<h4 class="section">Property Value</h4>
<dl class="parameters">
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.ilist-1">IList</a>&lt;<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a>&gt;</dt>
<dd><p>A set of preference-ordered base directories to which configuration files should be searched.</p>
</dd>
</dl>
<h4 class="section" id="Xdg_Directories_BaseDirectory_ConfigDirs_remarks">Remarks</h4>
<div class="markdown level1 remarks"><p>If <code>XDG_CONFIG_DIRS</code> is set, a list of the directories specified.</p>
<table><tbody><tr><td class="term">Windows</td><td class="description"><code>%ProgramData%</code>,
<code>%APPADATA%</code></td></tr><tr><td class="term">macOS</td><td class="description"><code>~/Library/Preferences</code>,
<code>/Library/Application Support</code>,
<code>/Library/Preferences</code></td></tr><tr><td class="term">Linux/FreeBSD</td><td class="description"><code>/etc/xdg</code></td></tr></tbody></table>
This is typically not used, for most use cases <a class="xref" href="Xdg.Directories.BaseDirectory.html#Xdg_Directories_BaseDirectory_ConfigHome">ConfigHome</a> should be used instead.
</div>
<a id="Xdg_Directories_BaseDirectory_ConfigHome_" data-uid="Xdg.Directories.BaseDirectory.ConfigHome*"></a>
<h3 id="Xdg_Directories_BaseDirectory_ConfigHome" data-uid="Xdg.Directories.BaseDirectory.ConfigHome">
ConfigHome
<a class="header-action link-secondary" title="View source" href="https://github.com/xdg-net/Xdg.Directories/blob/master/src/Xdg.Directories/BaseDirectory.cs/#L23"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>Base directory for configuration files.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static string ConfigHome { get; }</code></pre>
</div>
<h4 class="section">Property Value</h4>
<dl class="parameters">
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
<dd><p>A single base directory relative to which user-specifc <strong>configuration</strong> files should be written.</p>
</dd>
</dl>
<h4 class="section" id="Xdg_Directories_BaseDirectory_ConfigHome_remarks">Remarks</h4>
<div class="markdown level1 remarks"><p>If <code>XDG_CONFIG_HOME</code> is set, the directory specified.</p>
<table><tbody><tr><td class="term">Windows</td><td class="description"><code>%LOCALAPPDATA%</code></td></tr><tr><td class="term">macOS</td><td class="description"><code>$HOME/Library/Application Support</code></td></tr><tr><td class="term">Linux/FreeBSD</td><td class="description"><code>$HOME/.config</code></td></tr></tbody></table>
</div>
<a id="Xdg_Directories_BaseDirectory_DataDirs_" data-uid="Xdg.Directories.BaseDirectory.DataDirs*"></a>
<h3 id="Xdg_Directories_BaseDirectory_DataDirs" data-uid="Xdg.Directories.BaseDirectory.DataDirs">
DataDirs
<a class="header-action link-secondary" title="View source" href="https://github.com/xdg-net/Xdg.Directories/blob/master/src/Xdg.Directories/BaseDirectory.cs/#L69"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>A list of directories to search for data files.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static IList&lt;string&gt; DataDirs { get; }</code></pre>
</div>
<h4 class="section">Property Value</h4>
<dl class="parameters">
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.ilist-1">IList</a>&lt;<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a>&gt;</dt>
<dd><p>A set of preference-ordered base directories to which data files should be searched.</p>
</dd>
</dl>
<h4 class="section" id="Xdg_Directories_BaseDirectory_DataDirs_remarks">Remarks</h4>
<div class="markdown level1 remarks"><p>If <code>XDG_DATA_DIRS</code> is set, a list of the directories specified.</p>
<table><tbody><tr><td class="term">Windows</td><td class="description"><code>%APPADATA%</code>,
<code>%ProgramData%</code></td></tr><tr><td class="term">macOS</td><td class="description"><code>/Library/Application Support</code></td></tr><tr><td class="term">Linux/FreeBSD</td><td class="description"><code>/usr/local/share/</code>,
<code>/usr/share/</code></td></tr></tbody></table>
</div>
<a id="Xdg_Directories_BaseDirectory_DataHome_" data-uid="Xdg.Directories.BaseDirectory.DataHome*"></a>
<h3 id="Xdg_Directories_BaseDirectory_DataHome" data-uid="Xdg.Directories.BaseDirectory.DataHome">
DataHome
<a class="header-action link-secondary" title="View source" href="https://github.com/xdg-net/Xdg.Directories/blob/master/src/Xdg.Directories/BaseDirectory.cs/#L7"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>Base directory for data files.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static string DataHome { get; }</code></pre>
</div>
<h4 class="section">Property Value</h4>
<dl class="parameters">
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
<dd><p>A single base directory relative to which user-specifc <strong>data</strong> files should be written.</p>
</dd>
</dl>
<h4 class="section" id="Xdg_Directories_BaseDirectory_DataHome_remarks">Remarks</h4>
<div class="markdown level1 remarks"><p>If <code>XDG_DATA_HOME</code> is set, the directory specified.</p>
<table><tbody><tr><td class="term">Windows</td><td class="description"><code>%LOCALAPPDATA%</code></td></tr><tr><td class="term">macOS</td><td class="description"><code>$HOME/Library/Application Support</code></td></tr><tr><td class="term">Linux/FreeBSD</td><td class="description"><code>$HOME/.local/share</code></td></tr></tbody></table>
</div>
<a id="Xdg_Directories_BaseDirectory_RuntimeDir_" data-uid="Xdg.Directories.BaseDirectory.RuntimeDir*"></a>
<h3 id="Xdg_Directories_BaseDirectory_RuntimeDir" data-uid="Xdg.Directories.BaseDirectory.RuntimeDir">
RuntimeDir
<a class="header-action link-secondary" title="View source" href="https://github.com/xdg-net/Xdg.Directories/blob/master/src/Xdg.Directories/BaseDirectory.cs/#L134"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>Base directory for runtime-specific files.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static string RuntimeDir { get; }</code></pre>
</div>
<h4 class="section">Property Value</h4>
<dl class="parameters">
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
<dd><p>A single base directory relative to which user-specifc <strong>runtime files</strong> should be written.</p>
</dd>
</dl>
<h4 class="section" id="Xdg_Directories_BaseDirectory_RuntimeDir_remarks">Remarks</h4>
<div class="markdown level1 remarks"><p>If <code>XDG_RUNTIME_DIR</code> is set, the directory specified.</p>
<table><tbody><tr><td class="term">Windows</td><td class="description"><code>%LOCALAPPDATA%</code></td></tr><tr><td class="term">macOS</td><td class="description"><code>$HOME/Library/Application Support</code></td></tr><tr><td class="term">Linux/FreeBSD</td><td class="description"><code>/run/user/$UID</code></td></tr></tbody></table>
</div>
<a id="Xdg_Directories_BaseDirectory_StateHome_" data-uid="Xdg.Directories.BaseDirectory.StateHome*"></a>
<h3 id="Xdg_Directories_BaseDirectory_StateHome" data-uid="Xdg.Directories.BaseDirectory.StateHome">
StateHome
<a class="header-action link-secondary" title="View source" href="https://github.com/xdg-net/Xdg.Directories/blob/master/src/Xdg.Directories/BaseDirectory.cs/#L39"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>Base directory for state data.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static string StateHome { get; }</code></pre>
</div>
<h4 class="section">Property Value</h4>
<dl class="parameters">
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
<dd><p>A single base directory relative to which user-specifc <strong>state data</strong> should be written.</p>
</dd>
</dl>
<h4 class="section" id="Xdg_Directories_BaseDirectory_StateHome_remarks">Remarks</h4>
<div class="markdown level1 remarks"><p>If <code>XDG_STATE_HOME</code> is set, the directory specified.</p>
<table><tbody><tr><td class="term">Windows</td><td class="description"><code>%LOCALAPPDATA%</code></td></tr><tr><td class="term">macOS</td><td class="description"><code>$HOME/Library/Application Support</code></td></tr><tr><td class="term">Linux/FreeBSD</td><td class="description"><code>$HOME/.local/state</code></td></tr></tbody></table>
</div>
</article>
<div class="contribution d-print-none">
<a href="https://github.com/xdg-net/Xdg.Directories/blob/master/src/Xdg.Directories/BaseDirectory.cs/#L4" class="edit-link">Edit this page</a>
</div>
</div>
<div class="affix">
<nav id="affix"></nav>
</div>
</main>
<div class="container-xxl search-results" id="search-results"></div>
<footer class="border-top text-secondary">
<div class="container-xxl">
<div class="flex-fill">
<span>Made with <a href="https://dotnet.github.io/docfx">docfx</a></span>
</div>
</div>
</footer>
</body>
</html>