@@ -13,6 +13,7 @@ use std::fs::read_to_string;
1313use std:: path:: Path ;
1414
1515use anyhow:: bail;
16+ use anyhow:: Context ;
1617use clap:: value_parser;
1718use clap:: Parser ;
1819use code:: create_code;
@@ -21,7 +22,6 @@ use codesnap::assets::Assets;
2122use codesnap:: assets:: AssetsURL ;
2223use codesnap:: config:: CodeSnap ;
2324use codesnap:: config:: SnapshotConfig ;
24- use codesnap:: utils:: path:: parse_home_variable;
2525use config:: CodeSnapCLIConfig ;
2626use egg:: say;
2727use theme_converter:: { parser:: Parser as ThemeParser , vscode} ;
@@ -334,12 +334,20 @@ async fn create_snapshot_config(
334334 . scale_factor ( cli. scale_factor )
335335 . build ( ) ?;
336336
337- let mut themes_folders = codesnap. themes_folders ;
338- let remote_themes_path = parse_home_variable ( "~/.config/CodeSnap/remote_themes" ) ?;
339-
337+ let remote_themes_path = home:: home_dir ( )
338+ . context ( "Unable to get your home dir" ) ?
339+ . join ( ".config" )
340+ . join ( "CodeSnap" )
341+ . join ( "remote_themes" ) ;
340342 std:: fs:: create_dir_all ( & remote_themes_path) ?;
343+
344+ let remote_themes_path = remote_themes_path
345+ . to_str ( )
346+ . context ( "Invalid remote theme path" ) ?;
347+
348+ let mut themes_folders = codesnap. themes_folders ;
341349 // The remote themes folder is used to store the themes downloaded from the internet
342- themes_folders. push ( remote_themes_path. clone ( ) ) ;
350+ themes_folders. push ( remote_themes_path. to_owned ( ) ) ;
343351
344352 codesnap. themes_folders = themes_folders;
345353 codesnap. fonts_folders = codesnap. fonts_folders ;
0 commit comments