File tree Expand file tree Collapse file tree 3 files changed +6
-3
lines changed Expand file tree Collapse file tree 3 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -321,7 +321,7 @@ impl Default for ConfigCliOptions {
321
321
fn default ( ) -> Self {
322
322
ConfigCliOptions {
323
323
// Not sure about unwrap
324
- config_path : Some ( dirs:: config_dir ( ) . unwrap ( ) . join ( "onefetch/config.toml" ) ) ,
324
+ config_path : Some ( dirs:: config_dir ( ) . expect ( "Could not find $HOME!" ) . join ( "onefetch/config.toml" ) ) ,
325
325
generate_config : false ,
326
326
}
327
327
}
Original file line number Diff line number Diff line change @@ -43,7 +43,7 @@ impl ConfigOptions {
43
43
{
44
44
// I dont think this can panic so i simply unwrapped it
45
45
let defaults = toml:: to_string ( & Self :: default ( ) ) . unwrap ( ) ;
46
- match fs:: create_dir_all ( & path) {
46
+ match fs:: create_dir_all ( & path. as_ref ( ) . parent ( ) . unwrap_or ( Path :: new ( "/" ) ) ) {
47
47
Ok ( _) => match fs:: write ( & path, & defaults) {
48
48
Ok ( _) => {
49
49
let path = path. as_ref ( ) . display ( ) ;
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ use onefetch::config::ConfigOptions;
8
8
use onefetch:: info:: build_info;
9
9
use onefetch:: ui:: printer:: Printer ;
10
10
use std:: io;
11
+ use std:: process:: exit;
11
12
12
13
fn main ( ) -> Result < ( ) > {
13
14
setup_panic ! ( ) ;
@@ -32,7 +33,9 @@ fn main() -> Result<()> {
32
33
}
33
34
34
35
if cli_options. config . generate_config {
35
- return ConfigOptions :: write_default ( cli_options. config . config_path . unwrap_or_default ( ) ) ;
36
+ // what the actual FUCK is happening here?
37
+ // why default path is EMPTY?
38
+ return ConfigOptions :: write_default ( & cli_options. config . config_path . unwrap_or_default ( ) ) ;
36
39
}
37
40
38
41
let config_options = ConfigOptions :: read ( & cli_options. config . config_path . clone ( ) . unwrap_or_default ( ) ) ;
You can’t perform that action at this time.
0 commit comments