kamiyaa / joshuto

ranger-like terminal file manager written in Rust
https://crates.io/crates/joshuto
GNU Lesser General Public License v3.0
3.36k stars 148 forks source link

Panic at unwrap() #99

Closed levone1 closed 2 years ago

levone1 commented 2 years ago

Using latest ver. on SailfishOS. Installs from crates.io or from building on-device w/ no problem, but won't open. Gives:

"thread 'main' panicked at 'called Result::unwrap() on an Err value : JoshutoError { _kind: TomlDeError (Error { inner: ErrorInner { kind: NewlineInString, line: Some(25), co l: 13, at: Some(1035), message: "", key: [] } }), _cause: "Failed to p arse TOML" }', src/config/keymap/ke ymapping.rs:100:38"

Line 100 says:

"AppKeyMapping::default_res().expect()"

Context is:

"impl TomlConfigFile for AppKeyMapping { fn get_config(file_name: &str) -> Self { parse_to_config_file::<AppKeyMappingCrude, AppKeyMapping>(file_name) .unwrap_or_else(Self::default) } }

impl std::default::Default for AppKeyMapping { fn default() -> Self { AppKeyMapping::default_res().expect() } }"

I'm not familiar with Rust code, so not sure if the error is there, or if that just indicates an error somewhere else...

Thanks

levone1 commented 2 years ago

... changed extension to txt for Github keymap.txt

levone1 commented 2 years ago

@inoshy I see from lines 60-72 there are seemingly similar command types but with different syntaxes, (some with (:command ) and some just (command)...

levone1 commented 2 years ago

Replaced all four files one-by-one, and same error each time... Maybe something in my env?

kamiyaa commented 2 years ago

This looks like an issue where joshuto can't find your config files and is defaulting to the default config file. Then the default config file has an error in it.

I've made changes to fix the default config not being valid, but it appears its something to do with your set up and joshuto not finding your config files.

joshuto looks for configs in the following order:

  1. $JOSHUTO_CONFIG_HOME environment variable
  2. whatever xdg has setup + /joshuto
  3. $HOME/.config/joshuto
  4. ./config this is for debugging only and should never be used.

Hope this helps and let me know if you have anymore issues!

kamiyaa commented 2 years ago

Not sure why the pull request automatically closed this issue

levone1 commented 2 years ago

ok. That fixed it - working now... Thanks