Commit bcb5172
authored
Improve obsidian config logic (#45)
#### [Get all potential obsidian global config
locations](a5136b1)
> Due to the nature of this functionality being reliant of another
> application called Obsidian, we must take into account possible
> sandboxed installations on Linux systems (e.g. flatpak, snap).
>
> Additionally, this global config location can be controlled with an
> environment variable called `OBSIDIAN_CONFIG_DIR`, which can be given
a
> `~` symbol to mark the home directory. The `~` symbol is transformed
to
> the absolute home directory path.
>
> The obsidian_global_config_locations() returns all potential directory
> paths for Obsidian.
>
> On macOS and Windows we default to the regular paths defined in the
> Obsidian documentation:
>
> - macOS: /Users/username/Library/Application Support/obsidian
> - Windows: %APPDATA%\Obsidian\
>
> From this list of returned configs we filter out any paths that do not
> exist and then we select the first one, as the returned list is in
order
> of priority:
>
> 1. The `OBSIDIAN_CONFIG_DIR` environment variable
> 2. User config directory
> 3. Flatpak config
> 4. Snap config
>
> If no paths can be certainly determined to be directories we fail with
> an error that displays all the configs we tried to access.
>
> This change should fix #44.
#### [Use try_exists in load_from for global Obsidian
config](9f5359d)
> Previously we naively assumed that the config file exists, now a more
> explicit domain error is returned.
#### [Remove created field from Note as
obsolete](fa17bf6)
> The existence of this field could result notes from being read into
the
> program due to the fact that some systems do not support the file
> creation time metadata.
>
> This functionality was now removed, since it was not in use in
> basalt-tui.
#### [Return Vec instead of Iterator from
notes()](d56f252)9 files changed
Lines changed: 161 additions & 156 deletions
File tree
- basalt-core
- src/obsidian
- basalt
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
3 | 20 | | |
4 | 21 | | |
5 | 22 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| |||
0 commit comments