Skip to content

Commit

Permalink
{HOME}/.rio/rio.toml for macos and linux
Browse files Browse the repository at this point in the history
  • Loading branch information
raphamorim committed Mar 27, 2023
1 parent ff7c79a commit 2044c3a
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 11 deletions.
3 changes: 2 additions & 1 deletion .cargo/config
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[alias]
testrenderer = "test --release -p renderer --"
testconfig = "test --release -p config --"
testconfig = "test --release -p config --"
pubcrates = "publish -p teletypewriter --"
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Rio 0.0.1

- `Teletypewriter` 1.0.2 first release published.
- `Teletypewriter` 1.0.5 usage for macos and linux.
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,9 @@ It also relies on Rust memory behavior, since Rust is a memory-safe language tha

The configuration should be the following paths otherwise Rio will use the default configuration.

- macOS path: `~/.config/rio.toml`
- macOS path: `~/.rio/config.toml`

> `$XDG_CONFIG_HOME` defines the base directory relative to which user specific configuration files should be stored. If `$XDG_CONFIG_HOME` is either not set or empty, a default equal to `$HOME/.config` should be used.
Default configuration of `rio.toml`:
Default configuration of `config.toml`:

```toml
# Rio default configuration file
Expand Down
3 changes: 1 addition & 2 deletions ansi-machine/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ use std::io::{BufReader, Read};
use std::sync::Arc;
use std::sync::Mutex;
use teletypewriter::Process;
use vte::ParamsIter;
// https://vt100.net/emu/dec_ansi_parser
use vte::{Params, Parser};
use vte::{Params, ParamsIter, Parser};

pub type Square = crosswords::square::Square;
pub type Row = crosswords::row::Row<Square>;
Expand Down
6 changes: 3 additions & 3 deletions config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,11 @@ impl Config {
}

pub fn load_macos() -> Self {
// XDG base directory
let base_dir_buffer = dirs::config_dir().unwrap();
// Home directory
let base_dir_buffer = dirs::home_dir().unwrap();
let base_dir = base_dir_buffer.to_str().unwrap();

let path = format!("{base_dir}/rio.toml");
let path = format!("{base_dir}/.rio/config.toml");
if std::path::Path::new(&path).exists() {
let content = std::fs::read_to_string(path).unwrap();
match toml::from_str(&content) {
Expand Down

0 comments on commit 2044c3a

Please sign in to comment.