mirror of
https://github.com/dexoron/dcr.git
synced 2026-10-22 10:09:36 +00:00
feat: add .dcr/ build facts and canonical artifact paths for IDE integrations
This commit is contained in:
@@ -15,37 +15,39 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use super::path_util::{default_bin_rel, default_lib_rel, join_dir};
|
||||
|
||||
pub fn bin_path(profile: &str, name: &str, target_dir: Option<&str>) -> String {
|
||||
match target_dir {
|
||||
Some(dir) => format!("{}/{}", dir.trim_end_matches('/'), name),
|
||||
None => format!("./target/{profile}/{name}"),
|
||||
Some(dir) => join_dir(dir, name),
|
||||
None => default_bin_rel(profile, name, None),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn lib_path(profile: &str, name: &str, target_dir: Option<&str>) -> String {
|
||||
let file = format!("lib{name}.a");
|
||||
match target_dir {
|
||||
Some(dir) => format!("{}/lib{}.a", dir.trim_end_matches('/'), name),
|
||||
None => format!("./target/{profile}/lib{name}.a"),
|
||||
Some(dir) => join_dir(dir, &file),
|
||||
None => default_lib_rel(profile, &file, None),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn elf_path(profile: &str, name: &str, target_dir: Option<&str>) -> String {
|
||||
match target_dir {
|
||||
Some(dir) => format!("{}/{}", dir.trim_end_matches('/'), name),
|
||||
None => format!("./target/{profile}/{name}"),
|
||||
}
|
||||
bin_path(profile, name, target_dir)
|
||||
}
|
||||
|
||||
pub fn efi_path(profile: &str, name: &str, target_dir: Option<&str>) -> String {
|
||||
let file = format!("{name}.efi");
|
||||
match target_dir {
|
||||
Some(dir) => format!("{}/{}.efi", dir.trim_end_matches('/'), name),
|
||||
None => format!("./target/{profile}/{name}.efi"),
|
||||
Some(dir) => join_dir(dir, &file),
|
||||
None => default_lib_rel(profile, &file, None),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn shared_lib_path(profile: &str, name: &str, target_dir: Option<&str>) -> String {
|
||||
let file = format!("lib{name}.dylib");
|
||||
match target_dir {
|
||||
Some(dir) => format!("{}/lib{}.dylib", dir.trim_end_matches('/'), name),
|
||||
None => format!("./target/{profile}/lib{name}.dylib"),
|
||||
Some(dir) => join_dir(dir, &file),
|
||||
None => default_lib_rel(profile, &file, None),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user