mirror of
https://github.com/dexoron/dcr.git
synced 2026-10-21 15:49:40 +00:00
Custom output directory via build.target
This commit is contained in:
@@ -5,21 +5,24 @@ pub mod macos;
|
||||
#[cfg(target_os = "windows")]
|
||||
pub mod windows;
|
||||
|
||||
pub fn bin_path(profile: &str, name: &str) -> String {
|
||||
pub fn bin_path(profile: &str, name: &str, target_dir: Option<&str>) -> String {
|
||||
#[cfg(target_os = "linux")]
|
||||
{
|
||||
linux::bin_path(profile, name)
|
||||
linux::bin_path(profile, name, target_dir)
|
||||
}
|
||||
#[cfg(target_os = "macos")]
|
||||
{
|
||||
return macos::bin_path(profile, name);
|
||||
return macos::bin_path(profile, name, target_dir);
|
||||
}
|
||||
#[cfg(target_os = "windows")]
|
||||
{
|
||||
return windows::bin_path(profile, name);
|
||||
return windows::bin_path(profile, name, target_dir);
|
||||
}
|
||||
#[cfg(not(any(target_os = "linux", target_os = "macos", target_os = "windows")))]
|
||||
{
|
||||
format!("./target/{profile}/{name}")
|
||||
match target_dir {
|
||||
Some(dir) => format!("{}/{}", dir.trim_end_matches('/'), name),
|
||||
None => format!("./target/{profile}/{name}"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user