Signed-off-by: Sam Therapy <sam@samtherapy.net>
This commit is contained in:
parent
2d5ed7a739
commit
e3d3a96c70
5 changed files with 123 additions and 152 deletions
30
.drone.yml
30
.drone.yml
|
@ -1,30 +0,0 @@
|
|||
kind: pipeline
|
||||
type: docker
|
||||
name: Public Preview Builds
|
||||
trigger:
|
||||
branch:
|
||||
- master
|
||||
event:
|
||||
- push
|
||||
- tag
|
||||
|
||||
steps:
|
||||
- name: Fetch Tags
|
||||
image: alpine/git
|
||||
commands:
|
||||
- git fetch --tags
|
||||
- name: Build for Release
|
||||
image: mcr.microsoft.com/dotnet/sdk:8.0
|
||||
commands:
|
||||
- dotnet build -c Release -p:SymbolPackageFormat=symbols.nupkg -p:ContinuousIntegrationBuild=true
|
||||
- dotnet build -c Release -p:ContinuousIntegrationBuild=true
|
||||
- name: Publish
|
||||
image: mcr.microsoft.com/dotnet/sdk:8.0
|
||||
environment:
|
||||
API_KEY:
|
||||
from_secret: API_KEY
|
||||
NUGET_REPO: https://git.froth.zone/api/packages/sam/nuget/index.json
|
||||
commands:
|
||||
- cd src/Xdg.Directories
|
||||
- dotnet nuget push bin/Release/\*.symbols.nupkg --api-key $API_KEY --source $NUGET_REPO
|
||||
- dotnet nuget push bin/Release/\*.snupkg --api-key $API_KEY --source $NUGET_REPO
|
|
@ -20,4 +20,4 @@ jobs:
|
|||
- name: Build
|
||||
run: dotnet build -c Release -p:SymbolPackageFormat=symbols.nupkg -p:ContinuousIntegrationBuild=true
|
||||
- name: Publish
|
||||
run: dotnet nuget push bin/Release/*.symbols.nupkg --api-key ${{ secrets.GITHUB_TOKEN }} --source https://git.froth.zone/api/packages/mirrors/nuget/index.json
|
||||
run: dotnet nuget push src/Xdg.Directories/bin/Release/*.symbols.nupkg --api-key ${{ secrets.GITHUB_TOKEN }} --source https://git.froth.zone/api/packages/mirrors/nuget/index.json
|
119
.github/README.md
vendored
Normal file
119
.github/README.md
vendored
Normal file
|
@ -0,0 +1,119 @@
|
|||
# Xdg.Net
|
||||
|
||||
> A .NET Standard library for the XDG Base Directory Specification and XDG user directories.
|
||||
|
||||
[![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/xdg-net/xdg.directories/build-test.yaml?style=for-the-badge&logo=github)](https://github.com/xdg-net/Xdg.Net/actions/workflows/build-test.yaml)
|
||||
[![NuGet Version](https://img.shields.io/nuget/v/xdg.directories?style=for-the-badge&logo=nuget)](https://www.nuget.org/packages/Xdg.Directories/)
|
||||
[![MIT License](https://img.shields.io/github/license/xdg-net/xdg.directories?style=for-the-badge)](https://choosealicense.com/licenses/mit/)
|
||||
|
||||
Xdg.Net is a ***small*** (the .dll is only 11 KB), [***fast***](./src/Xdg.Benchmarks/README.md) and ***portable*** (Completely supports .NET Standard 2.0 and even NativeAOT!) .NET implementation of the [XDG Base Directory Specification](https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html) and XDG user directories for Windows, MacOS and Linux/FreeBSD.
|
||||
|
||||
<!--
|
||||
<p align="center">
|
||||
<a href="https://github.com/xdg-net/Xdg.Net/actions/workflows/build-test.yaml/badge.svg" rel="nofollow">
|
||||
<img src="https://github.com/xdg-net/Xdg.Net/actions/workflows/build-test.yaml/badge.svg" alt="GitHub Actions status">
|
||||
</a>
|
||||
<a href="https://www.nuget.org/packages/Xdg.Directories" rel="nofollow">
|
||||
<img src="https://img.shields.io/nuget/v/Xdg.Directories" alt="NuGet">
|
||||
</a>
|
||||
</p> -->
|
||||
|
||||
|
||||
|
||||
## Installation
|
||||
Use [NuGet](http://docs.nuget.org/docs/start-here/installing-nuge) to install [Xdg.Directories](thttps://www.nuget.org/packages/Xdg.Directories).
|
||||
|
||||
From the .NET CLI:
|
||||
|
||||
```bash
|
||||
dotnet add package Xdg.Directories
|
||||
```
|
||||
|
||||
or from Visual Studio's package manager:
|
||||
|
||||
```pwsh
|
||||
Install-Package Xdg.Directories
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
### Base Directories, C#
|
||||
|
||||
```csharp
|
||||
using System;
|
||||
using Xdg.Directories;
|
||||
|
||||
// Prints /home/$USER/.local/share
|
||||
Console.Writeline(BaseDirectory.DataHome);
|
||||
|
||||
// Prints /home/$USER/.cache
|
||||
Console.Writeline(BaseDirectory.CacheHome)
|
||||
```
|
||||
|
||||
### User Directories, F#
|
||||
|
||||
```fsharp
|
||||
open Xdg.Directories
|
||||
|
||||
// Prints /home/$USER/Documents
|
||||
printfn "%s" UserDirectory.DesktopDir
|
||||
```
|
||||
|
||||
## Default Locations
|
||||
|
||||
If any of the respective XDG environment are specified, the variable will always be returned.
|
||||
Otherwise, the value depends on the operating system.
|
||||
|
||||
Inspiration is taken from the [Go implementation](https://github.com/adrg/xdg) for Windows and MacOS directories.
|
||||
|
||||
<details open>
|
||||
<summary>Base Directory</summary>
|
||||
|
||||
| Environment Variable | Windows | macOS | Linux/FreeBSD |
|
||||
| --- | --- | --- | --- |
|
||||
| `XDG_DATA_HOME` | `%LOCALAPPDATA%` | `$HOME/Library/Application Support` | `$HOME/.local/share` |
|
||||
| `XDG_CONFIG_HOME` | `%LOCALAPPDATA%` | `$HOME/Library/Application Support` | `$HOME/.config` |
|
||||
| `XDG_STATE_HOME` | `%LOCALAPPDATA%` | `$HOME/Library/Application Support` | `$HOME/.local/state` |
|
||||
| `XDG_BIN_HOME` | `null` | `null` | `$HOME/.local/bin` |
|
||||
| `XDG_DATA_DIRS` | `%APPDATA%:%PROGRAMDATA%` | `/Library/Application Support` | `/usr/local/share:/usr/share` |
|
||||
| `XDG_CONFIG_DIRS` | `%LOCALAPPDATA%` | `$HOME/Library/Preferences:/Library/Application Support:/Library/Preferences` | `/etc/xdg` |
|
||||
| `XDG_CACHE_HOME` | `%LOCALAPPDATA%` | `$HOME/Library/Application Support` | `$HOME/.config` |
|
||||
| `XDG_RUNTIME_HOME` | `%LOCALAPPDATA%` | `$HOME/Library/Application Support` | `/run/user/$UID` |
|
||||
</details>
|
||||
|
||||
<details open>
|
||||
<summary>User Directory</summary>
|
||||
|
||||
User directories on Windows use [Known Folders](https://learn.microsoft.com/en-us/windows/win32/shell/known-folders).
|
||||
| Environment Variable | Windows | macOS | Linux/FreeBSD |
|
||||
| --- | --- | --- | --- |
|
||||
| `XDG_DESKTOP_DIR` | `Desktop` | `$HOME/Desktop` | `$HOME/Desktop` |
|
||||
| `XDG_DOWNLOAD_DIR` | `null` | `$HOME/Downloads` | `$HOME/Downloads` |
|
||||
| `XDG_DOCUMENTS_DIR` | `My Documents` | `$HOME/Documents` | `$HOME/Documents` |
|
||||
| `XDG_MUSIC_DIR` | `My Music` | `$HOME/Music` | `$HOME/Music` |
|
||||
| `XDG_PICTURES_DIRS` | `My Pictures` | `$HOME/Pictures` | `$HOME/Pictures` |
|
||||
| `XDG_VIDEOS_DIR` | `My Videos` | `$HOME/Movies` | `$HOME/Videos` |
|
||||
| `XDG_TEMPLATES_DIR` | `Templates` | `$HOME/Templates` | `$HOME/Templates` |
|
||||
| `XDG_PUBLICSHARE_DIR` | `%PUBLIC%` | `$HOME/Public` | `$HOME/Public` |
|
||||
</details>
|
||||
|
||||
<details open>
|
||||
<summary>Extra Directories</summary>
|
||||
|
||||
| | Windows | macOS | Linux/FreeBSD |
|
||||
| --- | --- | --- | --- |
|
||||
| Home | `%USERPROFILE%` | `$HOME` | `$HOME` |
|
||||
</details>
|
||||
|
||||
## Pre-releases
|
||||
|
||||
Preview releases are uploaded to both [GitHub packages](https://github.com/xdg-net/Xdg.Net/pkgs/nuget/Xdg.Directories) (need GitHub account to download) and [Forgejo packages](https://git.froth.zone/mirrors/-/packages/nuget/xdg.directories) (no login required).
|
||||
|
||||
|
||||
### Native Library (WIP)
|
||||
|
||||
[View the README here](./src/Xdg.Directories.FFI/README.md)
|
||||
|
||||
## License
|
||||
|
||||
[MIT](./LICENSE)
|
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -3,6 +3,8 @@
|
|||
##
|
||||
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
|
||||
|
||||
.mono
|
||||
|
||||
# User-specific files
|
||||
*.rsuser
|
||||
*.suo
|
||||
|
|
122
README.md
122
README.md
|
@ -1,121 +1 @@
|
|||
# Xdg.Net
|
||||
|
||||
> A .NET Standard library for the XDG Base Directory Specification and XDG user directories.
|
||||
|
||||
[![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/xdg-net/xdg.directories/build-test.yaml?style=for-the-badge&logo=github)](https://github.com/xdg-net/Xdg.Net/actions/workflows/build-test.yaml)
|
||||
[![NuGet Version](https://img.shields.io/nuget/v/xdg.directories?style=for-the-badge&logo=nuget)](https://www.nuget.org/packages/Xdg.Directories/)
|
||||
[![MIT License](https://img.shields.io/github/license/xdg-net/xdg.directories?style=for-the-badge)](https://choosealicense.com/licenses/mit/)
|
||||
|
||||
Xdg.Net is a ***small*** (the .dll is only 11 KB), [***fast***](./src/Xdg.Benchmarks/README.md) and ***portable*** (Completely supports .NET Standard 2.0 and even NativeAOT!) .NET implementation of the [XDG Base Directory Specification](https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html) and XDG user directories for Windows, MacOS and Linux/FreeBSD.
|
||||
|
||||
<!--
|
||||
<p align="center">
|
||||
<a href="https://github.com/xdg-net/Xdg.Net/actions/workflows/build-test.yaml/badge.svg" rel="nofollow">
|
||||
<img src="https://github.com/xdg-net/Xdg.Net/actions/workflows/build-test.yaml/badge.svg" alt="GitHub Actions status">
|
||||
</a>
|
||||
<a href="https://www.nuget.org/packages/Xdg.Directories" rel="nofollow">
|
||||
<img src="https://img.shields.io/nuget/v/Xdg.Directories" alt="NuGet">
|
||||
</a>
|
||||
</p> -->
|
||||
|
||||
|
||||
|
||||
## Installation
|
||||
Use [NuGet](http://docs.nuget.org/docs/start-here/installing-nuge) to install [Xdg.Directories](thttps://www.nuget.org/packages/Xdg.Directories).
|
||||
|
||||
From the .NET CLI:
|
||||
|
||||
```bash
|
||||
dotnet add package Xdg.Directories
|
||||
```
|
||||
|
||||
or from Visual Studio's package manager:
|
||||
|
||||
```pwsh
|
||||
Install-Package Xdg.Directories
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
### Base Directories, C#
|
||||
|
||||
```csharp
|
||||
using System;
|
||||
using Xdg.Directories;
|
||||
|
||||
// Prints /home/$USER/.local/share
|
||||
Console.Writeline(BaseDirectory.DataHome);
|
||||
|
||||
// Prints /home/$USER/.cache
|
||||
Console.Writeline(BaseDirectory.CacheHome)
|
||||
```
|
||||
|
||||
### User Directories, F#
|
||||
|
||||
```fsharp
|
||||
open Xdg.Directories
|
||||
|
||||
// Prints /home/$USER/Documents
|
||||
printfn "%s" UserDirectory.DesktopDir
|
||||
```
|
||||
|
||||
## Default Locations
|
||||
|
||||
If any of the respective XDG environment are specified, the variable will always be returned.
|
||||
Otherwise, the value depends on the operating system.
|
||||
|
||||
Inspiration is taken from the [Go implementation](https://github.com/adrg/xdg) for Windows and MacOS directories.
|
||||
|
||||
<details open>
|
||||
<summary>Base Directory</summary>
|
||||
|
||||
| Environment Variable | Windows | macOS | Linux/FreeBSD |
|
||||
| --- | --- | --- | --- |
|
||||
| `XDG_DATA_HOME` | `%LOCALAPPDATA%` | `$HOME/Library/Application Support` | `$HOME/.local/share` |
|
||||
| `XDG_CONFIG_HOME` | `%LOCALAPPDATA%` | `$HOME/Library/Application Support` | `$HOME/.config` |
|
||||
| `XDG_STATE_HOME` | `%LOCALAPPDATA%` | `$HOME/Library/Application Support` | `$HOME/.local/state` |
|
||||
| `XDG_BIN_HOME` | `null` | `null` | `$HOME/.local/bin` |
|
||||
| `XDG_DATA_DIRS` | `%APPDATA%:%PROGRAMDATA%` | `/Library/Application Support` | `/usr/local/share:/usr/share` |
|
||||
| `XDG_CONFIG_DIRS` | `%LOCALAPPDATA%` | `$HOME/Library/Preferences:/Library/Application Support:/Library/Preferences` | `/etc/xdg` |
|
||||
| `XDG_CACHE_HOME` | `%LOCALAPPDATA%` | `$HOME/Library/Application Support` | `$HOME/.config` |
|
||||
| `XDG_RUNTIME_HOME` | `%LOCALAPPDATA%` | `$HOME/Library/Application Support` | `/run/user/$UID` |
|
||||
</details>
|
||||
|
||||
<details open>
|
||||
<summary>User Directory</summary>
|
||||
|
||||
User directories on Windows use [Known Folders](https://learn.microsoft.com/en-us/windows/win32/shell/known-folders).
|
||||
| Environment Variable | Windows | macOS | Linux/FreeBSD |
|
||||
| --- | --- | --- | --- |
|
||||
| `XDG_DESKTOP_DIR` | `Desktop` | `$HOME/Desktop` | `$HOME/Desktop` |
|
||||
| `XDG_DOWNLOAD_DIR` | `null` | `$HOME/Downloads` | `$HOME/Downloads` |
|
||||
| `XDG_DOCUMENTS_DIR` | `My Documents` | `$HOME/Documents` | `$HOME/Documents` |
|
||||
| `XDG_MUSIC_DIR` | `My Music` | `$HOME/Music` | `$HOME/Music` |
|
||||
| `XDG_PICTURES_DIRS` | `My Pictures` | `$HOME/Pictures` | `$HOME/Pictures` |
|
||||
| `XDG_VIDEOS_DIR` | `My Videos` | `$HOME/Movies` | `$HOME/Videos` |
|
||||
| `XDG_TEMPLATES_DIR` | `Templates` | `$HOME/Templates` | `$HOME/Templates` |
|
||||
| `XDG_PUBLICSHARE_DIR` | `%PUBLIC%` | `$HOME/Public` | `$HOME/Public` |
|
||||
</details>
|
||||
|
||||
<details open>
|
||||
<summary>Extra Directories</summary>
|
||||
|
||||
| | Windows | macOS | Linux/FreeBSD |
|
||||
| --- | --- | --- | --- |
|
||||
| Home | `%USERPROFILE%` | `$HOME` | `$HOME` |
|
||||
</details>
|
||||
|
||||
## Packaging
|
||||
Stable releases are available on [NuGet](https://www.nuget.org/packages/Xdg.Directories/), and preview releases are uploaded to both [GitHub packages](https://github.com/xdg-net/Xdg.Net/pkgs/nuget/Xdg.Directories) (need GitHub account to download) and [Gitea packages](https://git.froth.zone/mirrors/-/packages/nuget/xdg.directories) (no login required).
|
||||
|
||||
```pwsh
|
||||
dotnet add package Xdg.Directories
|
||||
```
|
||||
|
||||
### Native Library (WIP)
|
||||
|
||||
[View the README here](./src/Xdg.Directories.FFI/README.md)
|
||||
|
||||
## License
|
||||
|
||||
[MIT](./LICENSE)
|
||||
# You should not see this :)
|
||||
|
|
Loading…
Reference in a new issue