Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/owlinux1000/dirlib
dirlib is a minimum library for getting a directory that is used by putting on configuration files.
https://github.com/owlinux1000/dirlib
config python utility-library
Last synced: about 11 hours ago
JSON representation
dirlib is a minimum library for getting a directory that is used by putting on configuration files.
- Host: GitHub
- URL: https://github.com/owlinux1000/dirlib
- Owner: owlinux1000
- License: mit
- Created: 2022-12-18T06:44:56.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2022-12-18T12:44:29.000Z (almost 2 years ago)
- Last Synced: 2024-10-13T14:26:44.256Z (about 1 month ago)
- Topics: config, python, utility-library
- Language: Python
- Homepage:
- Size: 10.7 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# dirlib
`dirlib` is a minimum library for getting a directory that is used by putting on configuration files. This is inspired by Golang standard library function called `os.UserConfigDir()`. Currently, Windows, Unix and macOS are supported.
## Installation
```
pip install dirlib
```## How to use
```python
import dirlib# On Windows
print(dirlib.user_config_dir()) #=> %AppData% or %UserProfile%# On Unix
print(dirlib.user_config_dir()) #=> $XDG_CONFIG_HOME or $HOME/.config# On macOS
print(dirlib.user_config_dir()) #=> $HOME/Libary/Application Support
````user_config_dir()` can pass the two arguments. The first one is an application name. Here is an example on Windows.
```python
import dirlib
app_name = "mysupercooltool"
print(dirlib.user_config_dir(app_name)) #=> C:\Users\chihiro\AppData\Roaming\mysupercooltool
```