Skip to content

Commit

Permalink
✨ Add inclusion of fingerprint in built packs, add constants for deve…
Browse files Browse the repository at this point in the history
…l pack dirs
  • Loading branch information
phoenixr-codes committed Apr 12, 2024
1 parent c5d1669 commit c5a7486
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
6 changes: 5 additions & 1 deletion src/cli/sync.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
use clap::{ArgMatches, Command};
use std::{env, path::PathBuf, process::ExitCode};

const DEV_BP: &'static str = "development_behavior_packs";
const DEV_RP: &'static str = "development_resource_packs";
const DEV_SP: &'static str = "development_skin_packs";

mod location {
use crate::diagnostic;
use std::{env, path::PathBuf};
Expand Down Expand Up @@ -56,5 +60,5 @@ pub fn run(matches: &ArgMatches) -> ExitCode {
None => return ExitCode::FAILURE,
},
};
todo!("find packs with same id as current project and update them")
todo!("find packs with same id as current project and update them");
}
9 changes: 9 additions & 0 deletions src/health.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,15 @@ impl Health {
true
}

pub fn check_all_except_uuids(&self) -> bool {
for success in [self.check_internal(), self.check_uuids_presence()] {
if !success {
return false;
}
}
true
}

pub fn check_internal(&self) -> bool {
let internal = self.root.join(paths::internal());
if internal.exists() {
Expand Down
8 changes: 6 additions & 2 deletions src/project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,11 @@ impl Project {
}

pub fn build(&mut self) -> Result<(), Box<dyn std::error::Error>> {
// FIXME: generate UUIDs if neccessary
let health = Health {
root: paths::root(),
fix: false,
};
if !health.check_all() {
if !health.check_all_except_uuids() {
return Err(Box::new(Error::InvalidProjectSetup));
};

Expand Down Expand Up @@ -132,6 +131,11 @@ impl Project {
&copy_options,
)?;

log::debug!("Adding fingerprint");
if let Err(e) = fs::write(&dest.join(".allay-fingerprint"), self.id) {
log::error!("Failed to add fingerprint: {}", e);
};

let generate_manifest = !match pack {
Pack::Behavior => self.config.bp.custom_manifest,
Pack::Resource => self.config.rp.custom_manifest,
Expand Down

0 comments on commit c5a7486

Please sign in to comment.