diff --git a/include/version.hpp b/include/version.hpp index 28c134f..4e79690 100644 --- a/include/version.hpp +++ b/include/version.hpp @@ -1 +1 @@ -static const char *VERSION = "7"; +static const char *VERSION = "8"; diff --git a/src/generator.cpp b/src/generator.cpp index 3681a0f..2ea79c9 100644 --- a/src/generator.cpp +++ b/src/generator.cpp @@ -109,6 +109,8 @@ static bool _recreate_file_(const std::filesystem::path& outpath, uint64_t file_ } if (needs_write) { + bool existed = fs::exists(outpath); + fs::create_directories(outpath.parent_path()); std::ofstream out(outpath, std::ios::binary); out.write(reinterpret_cast(filedata), filedata_len); @@ -116,7 +118,7 @@ static bool _recreate_file_(const std::filesystem::path& outpath, uint64_t file_ // Set the file permissions fs::permissions(outpath, file_perms); - if (!fs::exists(outpath)) { + if (!existed) { std::cout << "[dehydrate] " << outpath.filename() << ": created\n"; } else { std::cout << "[dehydrate] " << outpath.filename() << ": updated (hash changed)\n"; diff --git a/test.sh b/test.sh index 2be30a0..e9f6208 100755 --- a/test.sh +++ b/test.sh @@ -38,7 +38,7 @@ $TEST_DIR/testexe # third time just two files changed echo "----------------------------------------" -echo "Should be two changes: generator.cpp and hash.cpp" +echo "Should see: hash.cpp - updated, and generator.cpp - created." rm $TEST_DIR/temp/generator.cpp echo "whee!" >> $TEST_DIR/temp/hash.cpp