Skip to content

Commit

Permalink
fix: template not found
Browse files Browse the repository at this point in the history
  • Loading branch information
dcdgo committed Mar 9, 2021
1 parent 6a43cc0 commit 12f4672
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 9 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
Rust_part/template.svg
**/*.a
**/*.so
**/*.lib
Expand Down
4 changes: 0 additions & 4 deletions C_part/src/nsvg/copy.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,6 @@ char* gettemplate(int width, int height) {
size_t size;
char* data = NULL;
fp = fopen(TEMPLATE_PATH, "rb");

if(fp == NULL && chdir("./target/release/") == 0) { //couldnt find template here and alternative location DOES exist
fp = fopen(TEMPLATE_PATH, "rb");
}

if(fp == NULL) { //still null after trying fix
LOG_ERR("could not find svg template file.");
Expand Down
3 changes: 1 addition & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,4 @@ WORKDIR /home/sjsui/vectorizer/Rust_part/
RUN cargo build -vv --release

#create entrypoint of container
WORKDIR /home/sjsui/vectorizer/Rust_part/target/release/
CMD ["./trampoline"]
CMD ["./target/release/trampoline"]
4 changes: 1 addition & 3 deletions Rust_part/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,7 @@ fn main() {
//copy the template svg

let oldtemplate = String::from("../").add(TEMPLATE_NAME);
let mut newtemplate = var("OUT_DIR").unwrap();
newtemplate = newtemplate.add("/../../../"); //fixes wtf OUT_DIR useless af
newtemplate = newtemplate.add(TEMPLATE_NAME);
let newtemplate = String::from(TEMPLATE_NAME);
println!("copying template from: {}, to: {}", &oldtemplate, &newtemplate);
let _ = copy(oldtemplate, newtemplate);

Expand Down

0 comments on commit 12f4672

Please sign in to comment.