+ #[cfg(not(target_os = "windows"))]
+ #[allow(deprecated)]
+ if let Some(home_path) = std::env::home_dir() {
+ let mut rcfile = home_path.into_os_string();
+ rcfile.push(std::path::MAIN_SEPARATOR_STR);
+ rcfile.push(".naplayerrc");
+ debug_log!(self; {format!("opening settings file {rcfile}")});
+ if let Ok(file) = File::open(rcfile) {
+ let br = BufReader::new(file);
+ for (n, line) in br.lines().enumerate() {
+ if let Ok(line) = line {
+ let mut words: Vec<&str> = line.split_ascii_whitespace().collect();
+ if words.is_empty() || words[0].starts_with('#') {
+ continue;
+ }
+ if words.len() == 1 && words[0].contains('=') {
+ words = words[0].split('=').collect();
+ }
+ if words.is_empty() {
+ continue;
+ }
+ if words[0] == "scale_thr" {
+ let last_arg = words[words.len() - 1];
+ let dim: Vec<&str> = last_arg.split(['x', 'X']).collect();
+ if dim.len() != 2 {
+ println!(" expected 'scale_thr=WxH', got 'scale_thr={last_arg}'");
+ continue;
+ }
+ if let (Ok(thr_w), Ok(thr_h)) = (dim[0].parse::<usize>(), dim[1].parse::<usize>()) {
+ debug_log!(self; {format!(" set autoscale threshold to {thr_w}x{thr_h}")});
+ player.thr_w = thr_w;
+ player.thr_h = thr_h;
+ } else {
+ println!(" expected 'scale_thr=WxH', got 'scale_thr={last_arg}'");
+ continue;
+ }
+ }
+ } else {
+ println!(" error at line {n}");
+ break;
+ }
+ }
+ }
+ }
+