From 711accdc8fecf2207679af51df1e176cf751fc6b Mon Sep 17 00:00:00 2001 From: tastytea Date: Sun, 30 Dec 2018 03:14:32 +0100 Subject: [PATCH] Replicate the full path of the original file under cache_dir. Fixes #1 --- CMakeLists.txt | 2 +- src/main.cpp | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d9375f7..b2ca95d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required (VERSION 3.2) project(compilescript - VERSION 0.2.0 + VERSION 0.2.1 LANGUAGES CXX ) diff --git a/src/main.cpp b/src/main.cpp index 6f81ade..0dd3e28 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -93,10 +93,11 @@ int main(int argc, char *argv[]) return 1; } - const fs::path original(argv[1]); - const fs::path source = cache_dir / original.filename(); + const fs::path original = fs::canonical(argv[1]); + const fs::path source = cache_dir / original; const fs::path binary = (source.string() + ".bin"); string compiler_arguments; + fs::create_directories(binary.parent_path()); if (!fs::exists(binary) || fs::last_write_time(original) > fs::last_write_time(binary))