diff --git a/build.rs b/build.rs deleted file mode 100644 index 8d4dbc9..0000000 --- a/build.rs +++ /dev/null @@ -1,23 +0,0 @@ -use std::env; -use std::path::Path; -use std::fs::File; -use std::io::Write; - -fn main() { - if cfg!(feature = "offline") { - let manifest_dir = env::var("CARGO_MANIFEST_DIR").unwrap(); - - #[cfg(target_os = "windows")] - let manifest_dir = manifest_dir.replace(r#"\"#,r#"\\"#); - - let out_dir = env::var("OUT_DIR").unwrap(); - let dest_path = Path::new(&out_dir).join("path.rs"); - - let mut f = File::create(&dest_path).unwrap(); - write!( - f, - "pub const MANIFEST_DIR: &str = \"{}\";", - manifest_dir - ).unwrap(); - } -} \ No newline at end of file diff --git a/src/compile.rs b/src/compile.rs index 67ab198..8abefb0 100644 --- a/src/compile.rs +++ b/src/compile.rs @@ -7,9 +7,6 @@ use crate::types::{Command, Event, Parameter, Protocol, TypeElement, TypeEnum}; use proc_macro2::{Ident, Span, TokenStream}; use quote::quote; -#[cfg(feature = "offline")] -include!(concat!(env!("OUT_DIR"), "/path.rs")); - pub trait StringUtils { fn first_uppercase(&mut self); fn first_uppercased(self) -> Self; @@ -1268,7 +1265,12 @@ pub fn get_events( pub fn check_json(file_name: &str, commit: &str) -> Protocol { #[cfg(feature = "offline")] if cfg!(feature = "offline") { - let path = Path::new(MANIFEST_DIR).join("json").join(file_name); + let manifest_dir = std::env::var("CARGO_MANIFEST_DIR").unwrap(); + + #[cfg(target_os = "windows")] + let manifest_dir = manifest_dir.replace(r#"\"#,r#"\\"#); + + let path = Path::new(&manifest_dir).join("json").join(file_name); let json = std::fs::read_to_string(path).unwrap();