Skip to content

Commit

Permalink
Minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
akneni committed Jan 14, 2025
1 parent 1e23b8a commit c9342fe
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/package_manager.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use crate::config::{self, Config, Dependnecy};
use crate::constants::{CONFIG_FILE, PACKAGE_CONFIG_FILE, PACKAGE_DIR};
use crate::kiln_package::{self, KilnPackageConfig};
use crate::utils;
use std::collections::HashSet;
use std::env;
use std::ffi::OsStr;
Expand Down Expand Up @@ -588,6 +589,7 @@ fn copy_deps_global_to_local(pkg: &Package, dep_type: DepType) -> Result<(), Pkg
}

dbg!(&global_p);

fs::copy(global_p, new_p)?;
}
}
Expand Down
20 changes: 20 additions & 0 deletions src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ pub fn expand_user(path: &str) -> String {
}

/// Prints a warning message in a standardized way
/// This is used to print warnings related to static analysis
pub fn print_warning(
warning_source: &str,
filename: &str,
Expand All @@ -167,3 +168,22 @@ pub fn print_warning(
);
println!("{}\n", err_msg);
}


pub(super) fn create_symlink<T: AsRef<Path>>(src_file: T, dst_link: T) -> Result<(), std::io::Error> {
#[cfg(target_family = "unix")]
{
std::os::unix::fs::symlink(src_file, dst_link)?;
}
#[cfg(target_family = "windows")]
{
if original.is_file() {
std::os::windows::fs::symlink_file(src_file, dst_link)
} else if original.is_dir() {
std::os::windows::fs::symlink_dir(src_file, dst_link)
} else {
Err(io::Error::new(io::ErrorKind::Other, "Original path is neither a file nor a directory."))
}
}
Ok(())
}

0 comments on commit c9342fe

Please sign in to comment.