fix: Microsoft Windows

This commit is contained in:
2025-02-27 01:47:01 +00:00
parent 947b384511
commit 3d96d89846
5 changed files with 30 additions and 9 deletions

View File

@ -2,6 +2,7 @@ use log;
use std::collections::HashMap;
use std::path::PathBuf;
use tokio::sync::Mutex;
use tokio::fs;
use crate::pkg::{Package, PkgKey};
use crate::pkg_store::InstallResult;
@ -140,9 +141,25 @@ pub async fn init_profile(
new_profile.save().await;
appd.profile = Some(new_profile.clone());
fs::create_dir(new_profile.dir()).await
.map_err(|e| format!("Unable to create profile directory: {}", e))?;
Ok(new_profile)
}
#[tauri::command]
pub async fn profile_dir(
state: State<'_, Mutex<AppData>>
) -> Result<PathBuf, &str> {
let appd = state.lock().await;
if let Some(p) = &appd.profile {
Ok(p.dir())
} else {
Err("No profile loaded")
}
}
#[tauri::command]
pub async fn set_cfg(
state: State<'_, Mutex<AppData>>,

View File

@ -106,6 +106,7 @@ pub async fn run(_args: Vec<String>) {
cmd::get_current_profile,
cmd::init_profile,
cmd::save_profile,
cmd::profile_dir,
cmd::startline,
cmd::kill,
cmd::set_cfg,

View File

@ -7,7 +7,7 @@ use crate::profile::Profile;
use crate::util;
#[cfg(target_os = "windows")]
static CREATE_NO_WINDOW: i32 = 0x08000000;
static CREATE_NO_WINDOW: u32 = 0x08000000;
pub fn start(p: &Profile, app: AppHandle) -> Result<()> {
use tokio::task::JoinSet;