Skip to content

remove build.rs, use CARGO_MANIFEST_DIR env directly #22

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 0 additions & 23 deletions build.rs

This file was deleted.

10 changes: 6 additions & 4 deletions src/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();

Expand Down