From 0971f5b8266f6e4f49a26ec16f7a68f1a6e712ca Mon Sep 17 00:00:00 2001 From: SpikeHD Date: Tue, 26 Jul 2022 20:49:20 -0700 Subject: [PATCH] progress bar 'fix' --- package.json | 2 +- src-tauri/src/system_helpers.rs | 21 -------------------- src-tauri/src/unzip.rs | 6 +++--- src-tauri/tauri.conf.json | 2 +- src/ui/components/common/MainProgressBar.tsx | 2 +- 5 files changed, 6 insertions(+), 27 deletions(-) diff --git a/package.json b/package.json index b7f35e0..3f607b6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cultivation", - "version": "1.0.4", + "version": "1.0.5", "private": true, "dependencies": { "@tauri-apps/api": "^1.0.0-rc.5", diff --git a/src-tauri/src/system_helpers.rs b/src-tauri/src/system_helpers.rs index 24423b9..778bcef 100644 --- a/src-tauri/src/system_helpers.rs +++ b/src-tauri/src/system_helpers.rs @@ -18,8 +18,6 @@ pub fn run_program_relative(path: String, args: Option) { // Set new working directory std::env::set_current_dir(&path_buf).unwrap(); - println!("Opening {} {}", &path, args.clone().unwrap_or("".into())); - // Without unwrap_or, this can crash when UAC prompt is denied open::that(format!("{} {}", &path, args.unwrap_or("".into()))).unwrap_or(()); @@ -27,25 +25,6 @@ pub fn run_program_relative(path: String, args: Option) { std::env::set_current_dir(&cwd).unwrap(); } -#[tauri::command] -pub fn run_program_relative(path: String) { - // Save the current working directory - let cwd = std::env::current_dir().unwrap(); - - // Set the new working directory to the path before the executable - let mut path_buf = std::path::PathBuf::from(&path); - path_buf.pop(); - - // Open in new thread to prevent blocking. - std::thread::spawn(move || { - // Without unwrap_or, this can crash when UAC prompt is denied - open::that(&path).unwrap_or(()); - }); - - // Restore the original working directory - std::env::set_current_dir(&cwd).unwrap(); -} - #[tauri::command] pub fn run_command(program: &str, args: Vec<&str>) { let prog = program.to_string(); diff --git a/src-tauri/src/unzip.rs b/src-tauri/src/unzip.rs index b731095..7920622 100644 --- a/src-tauri/src/unzip.rs +++ b/src-tauri/src/unzip.rs @@ -1,7 +1,7 @@ use std::fs::{read_dir, File}; use std::path; use std::thread; -use unrar::archive::{Archive, OpenArchive}; +use unrar::archive::Archive; #[tauri::command] pub fn unzip( @@ -132,9 +132,9 @@ pub fn unzip( fn extract_rar( window: &tauri::Window, rarfile: &String, - f: &File, + _f: &File, full_path: &path::PathBuf, - top_level: bool, + _top_level: bool, ) { let archive = Archive::new(rarfile.clone()); diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 41b4c5a..2867cb2 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -7,7 +7,7 @@ }, "package": { "productName": "Cultivation", - "version": "1.0.4" + "version": "1.0.5" }, "tauri": { "allowlist": { diff --git a/src/ui/components/common/MainProgressBar.tsx b/src/ui/components/common/MainProgressBar.tsx index ac69e48..27e3df0 100644 --- a/src/ui/components/common/MainProgressBar.tsx +++ b/src/ui/components/common/MainProgressBar.tsx @@ -57,7 +57,7 @@ export default class ProgressBar extends React.Component { style={{ width: `${(() => { // Handles no files downloading - if (this.state.files === 0) { + if (this.state.files === 0 || this.state.average >= 100) { return '100' }