Skip to content

Commit

Permalink
Merge pull request #15 from BITNP:fix-macos-config-path
Browse files Browse the repository at this point in the history
fix: config root missing `$HOME/.config/bitsrun/` on macOS
  • Loading branch information
spencerwooo authored Jan 25, 2023
2 parents 51b76b4 + 1b9b676 commit 6beb2bf
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 9 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ _A headless login / logout script for 10.0.0.55 at BIT._

You need at least **Python 3.8**. We recommend installing with `pipx`.

```bash
```shell
python3 -m pip install --user pipx
python3 -m pipx ensurepath
```

After which, install `bitsrun` with `pipx`.

```bash
```shell
pipx install bitsrun
```

Expand Down Expand Up @@ -55,7 +55,7 @@ This file should be put under the following directory:

Now you can simply call:

```bash
```shell
bitsrun login
bitsrun logout
```
Expand All @@ -78,7 +78,7 @@ Import the two Raycast scripts from [`./scripts`](./scripts/) and setup your con

Install and run:

```bash
```shell
# Create virtual env and install deps
poetry install

Expand All @@ -91,7 +91,7 @@ pre-commit install

Build:

```bash
```shell
# Bump version
poetry version x.x.x

Expand All @@ -101,7 +101,7 @@ poetry build

Publish:

```bash
```shell
poetry publish
```

Expand Down
13 changes: 11 additions & 2 deletions bitsrun/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,21 @@ def get_config_paths() -> map:
- `C:\ProgramData\bitsrun\bit-user.json`
- `~\AppData\Roaming\bitsrun\bit-user.json`
On macOS and Linux:
On Linux:
- `/etc/bitsrun/bit-user.json`
- `$XDG_CONFIG_HOME/bitsrun/bit-user.json`
- `/etc/xdg/bitsrun/bit-user.json`
- `~/.config/bitsrun/bit-user.json`
- `~/.config/bit-user.json`
On macOS:
- `/etc/bit-user.json`
- `/Library/Preferences/bitsrun/bit-user.json`
- `$HOME/Library/Preferences/bitsrun/bit-user.json`
- `$HOME/.config/bit-user.json`
- `$HOME/.config/bitsrun/bit-user.json`
Returns:
A map of possible paths of the configuration file based on the current platform.
"""
Expand All @@ -43,6 +51,7 @@ def get_config_paths() -> map:
paths.append(Path(xdg_config_home))
else:
paths.append(Path.home() / ".config")
paths.append(paths[-1] / _APP_NAME)
else:
paths.append(user_config_path())

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "bitsrun"
version = "3.3.0"
version = "3.3.1"
description = "A headless login / logout script for 10.0.0.55"
authors = ["spencerwooo <spencer.woo@outlook.com>"]
license = "WTFPL"
Expand Down

0 comments on commit 6beb2bf

Please sign in to comment.