Skip to content

Commit

Permalink
Merge branch 'main' into codegen-one-file
Browse files Browse the repository at this point in the history
  • Loading branch information
jackTabsCode committed Aug 6, 2024
2 parents 1ba30d0 + 764a345 commit 0fa697c
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/commands/sync/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use config::SyncConfig;
use log::{debug, info, warn};
use std::{
collections::{BTreeMap, VecDeque},
path::Path,
path::{Path, PathBuf},
};
use tokio::fs::{read, read_dir, write, DirEntry};

Expand Down Expand Up @@ -182,12 +182,17 @@ pub async fn sync(args: SyncArgs, existing_lockfile: LockFile) -> anyhow::Result

let asset_dir = state.asset_dir.to_str().unwrap();

assets.extend(
state
.existing
.into_iter()
.map(|(path, asset)| (path, format_asset_id(asset.id))),
);
assets.extend(state.existing.into_iter().map(|(path, asset)| {
let mut path = PathBuf::from(path);

if !path.starts_with(asset_dir) {
path = PathBuf::from(asset_dir).join(path);
}

let path = path.to_str().unwrap().to_string();

(path, format_asset_id(asset.id))
}));

let codegen_output = generate_file(
&assets,
Expand Down

0 comments on commit 0fa697c

Please sign in to comment.