Skip to content

Commit 3ebaf76

Browse files
committed
fix: path logic (windows compat)
1 parent 4a524ac commit 3ebaf76

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

cli/src/main.rs

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ use std::fs::read_to_string;
1313
use std::path::Path;
1414

1515
use anyhow::bail;
16+
use anyhow::Context;
1617
use clap::value_parser;
1718
use clap::Parser;
1819
use code::create_code;
@@ -21,7 +22,6 @@ use codesnap::assets::Assets;
2122
use codesnap::assets::AssetsURL;
2223
use codesnap::config::CodeSnap;
2324
use codesnap::config::SnapshotConfig;
24-
use codesnap::utils::path::parse_home_variable;
2525
use config::CodeSnapCLIConfig;
2626
use egg::say;
2727
use 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

Comments
 (0)