ubuntu builds
@@ -45,8 +45,12 @@ pub fn build(stream: proc_macro::TokenStream) -> proc_macro::TokenStream {
let build = parse_macro_input!(stream as BuildMacro);
let tokens = RawString(build.into_tokens_string());
let target_dir = std::env::var("PATH").expect("No `PATH` env variable set");
- let end = target_dir.find(';').expect("Path not ending in `;`");
- let target_dir = RawString(target_dir[..end].to_string());
+
+ let target_dir = if let Some(end) = target_dir.find(';') {
+ RawString(target_dir[..end].to_string())
+ } else {
+ RawString("".to_string())
+ };
let tokens = quote! {
{
@@ -123,6 +127,8 @@ pub fn build(stream: proc_macro::TokenStream) -> proc_macro::TokenStream {
println!("cargo:rustc-link-search=native={}", source.to_str().expect("`CARGO_MANIFEST_DIR` not a valid path"));
let mut destination : ::std::path::PathBuf = #target_dir.into();
+
+ if destination.exists() {
destination.pop();
destination.pop();
@@ -135,6 +141,7 @@ pub fn build(stream: proc_macro::TokenStream) -> proc_macro::TokenStream {
source.push("winmd");
copy(&source, &mut destination);
}
+ }
};
tokens.as_str().parse().unwrap()
