Skip to content

Commit

Permalink
deltas,config: Skip some file existence checks based on config
Browse files Browse the repository at this point in the history
  • Loading branch information
derrod committed Feb 13, 2024
1 parent 7b32cea commit 26d9311
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/deltas.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ fn main() -> Result<()> {
let mut conf = Config::from_file(&args.config)?;
init_logger(conf.general.log_level.as_str());

conf.validate(true)?;
conf.validate(true, false)?;
let mut gen = Generator::init(&conf, false);
info!("Running generator...");
gen.create_patches().context("Creating delta patches failed!")?;
Expand Down
16 changes: 12 additions & 4 deletions src/models/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -302,10 +302,10 @@ impl Config {
self.package.updater.notes_file = fs::canonicalize(notes_file)?;
}

self.validate(false)
self.validate(false, args.packaging_only)
}

pub fn validate(&mut self, deltas_only: bool) -> Result<()> {
pub fn validate(&mut self, deltas_only: bool, packaging_only: bool) -> Result<()> {
// Output folder cannot be checked as it may not exist yet
match fs::canonicalize(&self.env.input_dir) {
Ok(res) => self.env.input_dir = res,
Expand Down Expand Up @@ -341,8 +341,12 @@ impl Config {
// Check file paths (for binaries, also check if they are in %PATH%)
misc::check_binary_path(&mut self.env.pdbcopy_path)?;
misc::check_binary_path(&mut self.env.makensis_path)?;
misc::check_binary_path(&mut self.env.sevenzip_path)?;
misc::check_binary_path(&mut self.env.pandoc_path)?;
if !self.package.zip.skip {
misc::check_binary_path(&mut self.env.sevenzip_path)?;
}
if !packaging_only {
misc::check_binary_path(&mut self.env.pandoc_path)?;
}

// Check if private key is set correctly (if signing is enabled)
if !self.package.updater.skip_sign {
Expand Down Expand Up @@ -394,6 +398,10 @@ impl Config {
bail!("NSIS script does not exist!")
}

if packaging_only {
return Ok(());
}

// Check that notes and vc redist files exists
if !self.package.updater.vc_redist_path.exists() {
bail!(
Expand Down

0 comments on commit 26d9311

Please sign in to comment.