mirror of
https://github.com/velopack/velopack.git
synced 2025-10-25 15:19:22 +00:00
Fix osx rust build
This commit is contained in:
@@ -1,26 +1,10 @@
|
||||
use anyhow::Result;
|
||||
use simplelog::*;
|
||||
use std::{env, path::PathBuf};
|
||||
use std::path::PathBuf;
|
||||
|
||||
pub fn trace_logger() {
|
||||
TermLogger::init(LevelFilter::Trace, Config::default(), TerminalMode::Mixed, ColorChoice::Never).unwrap();
|
||||
}
|
||||
pub fn default_logging(verbose: bool, nocolor: bool) -> Result<()> {
|
||||
#[cfg(target_os = "windows")]
|
||||
let default_log_file = {
|
||||
let mut my_dir = env::current_exe().unwrap();
|
||||
my_dir.pop();
|
||||
my_dir.join("Velopack.log")
|
||||
};
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
let default_log_file = {
|
||||
let (_root, manifest) = shared::detect_current_manifest().expect("Unable to load app manfiest.");
|
||||
std::path::Path::new(format!("/tmp/velopack/{}.log", manifest.id).as_str()).to_path_buf()
|
||||
};
|
||||
|
||||
setup_logging(Some(&default_log_file), true, verbose, nocolor)
|
||||
}
|
||||
|
||||
pub fn setup_logging(file: Option<&PathBuf>, console: bool, verbose: bool, nocolor: bool) -> Result<()> {
|
||||
let mut loggers: Vec<Box<dyn SharedLogger>> = Vec::new();
|
||||
|
||||
@@ -80,7 +80,7 @@ fn main() -> Result<()> {
|
||||
if let Some(log_file) = log_file {
|
||||
logging::setup_logging(Some(&log_file), true, verbose, nocolor)?;
|
||||
} else {
|
||||
logging::default_logging(verbose, nocolor)?;
|
||||
default_logging(verbose, nocolor)?;
|
||||
}
|
||||
|
||||
info!("Starting Velopack Updater ({})", env!("NGBV_VERSION"));
|
||||
@@ -165,6 +165,23 @@ fn uninstall(_matches: &ArgMatches) -> Result<()> {
|
||||
commands::uninstall(&root_path, &app, true)
|
||||
}
|
||||
|
||||
pub fn default_logging(verbose: bool, nocolor: bool) -> Result<()> {
|
||||
#[cfg(target_os = "windows")]
|
||||
let default_log_file = {
|
||||
let mut my_dir = env::current_exe().unwrap();
|
||||
my_dir.pop();
|
||||
my_dir.join("Velopack.log")
|
||||
};
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
let default_log_file = {
|
||||
let (_root, manifest) = shared::detect_current_manifest().expect("Unable to load app manfiest.");
|
||||
std::path::Path::new(format!("/tmp/velopack/{}.log", manifest.id).as_str()).to_path_buf()
|
||||
};
|
||||
|
||||
logging::setup_logging(Some(&default_log_file), true, verbose, nocolor)
|
||||
}
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
#[test]
|
||||
fn test_start_command_supports_legacy_commands() {
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
#![allow(unused_imports)]
|
||||
|
||||
mod common;
|
||||
use common::*;
|
||||
use std::{fs, path::Path, path::PathBuf};
|
||||
|
||||
Reference in New Issue
Block a user