Skip to content

Commit

Permalink
use opener instead of open-file
Browse files Browse the repository at this point in the history
  • Loading branch information
couleurm committed Apr 6, 2024
1 parent 3b6a1dd commit 0a524b0
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 7 deletions.
5 changes: 2 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ build = "build.rs"
clap = {version = "4.1.4 ", features = ["derive"] } # cli arg helper
color-eyre = "0.6.2" # error handling
ffprobe = "0.3.3"
open-file = "0.1.0" # open file with default app
opener = "0.7.0" # open file with default app
rand = "0.8.5" # randomly choose from fruits for suffix
rfd = "0.11.0" # open file dialog
which = "4.4.0" # Get-Command / where.exe / which alternative
Expand All @@ -18,15 +18,14 @@ which = "4.4.0" # Get-Command / where.exe / which alternative
serde = "1.0.152"
serde_derive = "1.0.152"
serde_json = "1.0.91"

colored = "2.0.0"
enable-ansi-support = "0.2.1"
num-rational = "0.4.1"
anyhow = "1.0.69"
ureq = { version = "2.6.2", features = ["json"] }
cty = "0.2.2"
bindgen = "0.64.0"
min-max = "0.1.8"
kdam = "0.1.7"
indicatif = { version = "0.17.2", features = ["improved_unicode"] }
regex = "1.7.2"
indexmap = { version = "2.2.6", features = ["serde"] }
Expand Down
44 changes: 40 additions & 4 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,8 @@ Arguments passed:
Note: If your PC is still going BRRR the video might still be rendering :)
Common troubleshooting errors are listed at ctt.cx/video/smoothie/troubleshooting
If you'd like help, take a screenshot of this message and your recipe and come over to discord.gg/CTT and make a post in #support
"#))
.set_level(rfd::MessageLevel::Error)
Expand Down Expand Up @@ -200,8 +202,36 @@ If you'd like help, take a screenshot of this message and your recipe and come o

let ini_path = presets_path.canonicalize().unwrap().display().to_string();

open_file::open(ini_path, None);
std::process::exit(0);
match opener::open(&ini_path){
Ok(()) =>{
std::process::exit(0);
}
Err(e) => {
panic!("Error {e}\n\nFailed opening file {:?}", ini_path);
}
}
}
"def" | "default" | "defaults" => {
let presets_path = current_exe_path.join("..").join("defaults.ini");

if !presets_path.exists() {
panic!(
"Could not find defaults.ini (expected at {})",
presets_path.display()
)
}

let ini_path = presets_path.canonicalize().unwrap().display().to_string();


match opener::open(&ini_path){
Ok(()) =>{
std::process::exit(0);
}
Err(e) => {
panic!("Error {e}\n\nFailed opening file {:?}", ini_path);
}
}
}
"rc" | "recipe" | "conf" | "config" => {
let ini_path = current_exe_path.join("..").join("recipe.ini");
Expand All @@ -212,8 +242,14 @@ If you'd like help, take a screenshot of this message and your recipe and come o

let ini_path = ini_path.canonicalize().unwrap().display().to_string();

open_file::open(ini_path, None);
std::process::exit(0);
match opener::open(&ini_path){
Ok(()) =>{
std::process::exit(0);
}
Err(e) => {
panic!("Error {e}\n\nFailed opening file {:?}", ini_path);
}
}
}
"root" | "dir" | "folder" => {
if cfg!(target_os = "windows") {
Expand Down

0 comments on commit 0a524b0

Please sign in to comment.