Skip to content

fix: path logic (windows compat) #103

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ use std::fs::read_to_string;
use std::path::Path;

use anyhow::bail;
use anyhow::Context;
use clap::value_parser;
use clap::Parser;
use code::create_code;
Expand All @@ -21,7 +22,6 @@ use codesnap::assets::Assets;
use codesnap::assets::AssetsURL;
use codesnap::config::CodeSnap;
use codesnap::config::SnapshotConfig;
use codesnap::utils::path::parse_home_variable;
use config::CodeSnapCLIConfig;
use egg::say;
use theme_converter::{parser::Parser as ThemeParser, vscode};
Expand Down Expand Up @@ -334,12 +334,20 @@ async fn create_snapshot_config(
.scale_factor(cli.scale_factor)
.build()?;

let mut themes_folders = codesnap.themes_folders;
let remote_themes_path = parse_home_variable("~/.config/CodeSnap/remote_themes")?;

let remote_themes_path = home::home_dir()
.context("Unable to get your home dir")?
.join(".config")
.join("CodeSnap")
.join("remote_themes");
std::fs::create_dir_all(&remote_themes_path)?;

let remote_themes_path = remote_themes_path
.to_str()
.context("Invalid remote theme path")?;

let mut themes_folders = codesnap.themes_folders;
// The remote themes folder is used to store the themes downloaded from the internet
themes_folders.push(remote_themes_path.clone());
themes_folders.push(remote_themes_path.to_owned());

codesnap.themes_folders = themes_folders;
codesnap.fonts_folders = codesnap.fonts_folders;
Expand Down