chiark
/
gitweb
/
~ian
/
mastodonochrome.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
a8d89f5
)
Try using xdg to get the config directory location.
author
Simon Tatham
<anakin@pobox.com>
Sat, 23 Dec 2023 11:58:04 +0000
(11:58 +0000)
committer
Simon Tatham
<anakin@pobox.com>
Sat, 23 Dec 2023 11:58:04 +0000
(11:58 +0000)
Cargo.toml
patch
|
blob
|
history
src/main.rs
patch
|
blob
|
history
diff --git
a/Cargo.toml
b/Cargo.toml
index 10b6e229fe14fd8d4020508e9e8f8c99fda9d745..5f6a2c0585f5c7232c67675b3e29d15caff582a9 100644
(file)
--- a/
Cargo.toml
+++ b/
Cargo.toml
@@
-12,3
+12,4
@@
reqwest = { version = "0.11.23", features = ["blocking"] }
serde = { version = "1.0.193", features = ["derive"] }
serde_json = "1.0.108"
unicode-width = "0.1.5"
+xdg = "2.5.2"
diff --git
a/src/main.rs
b/src/main.rs
index f562a7404b301ac90e07256c47f5220a90115488..fd695d6c80a57cc70bbb913ae98f3c74a8dfc5e0 100644
(file)
--- a/
src/main.rs
+++ b/
src/main.rs
@@
-2,8
+2,10
@@
use std::io::Read;
fn main() {
- let auth = std::fs::read_to_string(
- "/home/simon/.config/mastodonochrome/auth").unwrap();
+ let xdg_dirs = xdg::BaseDirectories::with_prefix("mastodonochrome")
+ .unwrap();
+ let authfile = xdg_dirs.get_config_file("auth");
+ let auth = std::fs::read_to_string(authfile).unwrap();
let auth: serde_json::Value = serde_json::from_str(&auth).unwrap();
let auth = &auth["user_token"].as_str().unwrap();