Onset: version control where nobody waits and nothing gets lost. The on command, its core and onset-server.
| /// VCS_HOME, else the platform's data folder (~/.local/share/vcs on Linux, |
| 6 | /// ~/Library/Application Support/vcs on macOS). |
| 7 | pub fn home() -> PathBuf { |
| 8 | if let Some(dir) = std::env::var_os("VCS_HOME") { |
| 9 | return PathBuf::from(dir); |
| 10 | } |
| 11 | let user = PathBuf::from(std::env::var_os("HOME").unwrap_or_else(|| ".".into())); |
| 12 | if cfg!(target_os = "macos") { |
| 13 | return user.join("Library/Application Support/vcs"); |
| 14 | } |
| 15 | match std::env::var_os("XDG_DATA_HOME") { |
| 16 | Some(d) if !d.is_empty() => PathBuf::from(d).join("vcs"), |
| 17 | _ => user.join(".local/share/vcs"), |
| 18 | } |
| 19 | } |
| 20 |
| 21 | pub fn objects() -> PathBuf { |
| 22 | home().join("objects") |
| 23 | } |
| 24 |
| 25 | /// Sign-in tokens, readable only by the user. |
| 26 | pub fn credentials() -> PathBuf { |
| 27 | home().join("credentials.json") |
| 28 | } |
| 29 |