Skip to content

Commit ddb288d

Browse files
authored
Added automatic update of sqfc file if it's older than the sqf one (#19)
* Fixed build (wrong include path); Added automatic update of file if sqf is newer than sqfc * revert changes to json lib path; my submodules were not updated when I pulled...oof
1 parent fed427b commit ddb288d

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/main.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,14 @@ void processFile(ScriptCompiler& comp, std::filesystem::path path) {
5555

5656

5757
auto outputPath = outputDir / pathRelative.parent_path() / (path.stem().string() + ".sqfc");
58-
59-
if (std::filesystem::exists(outputPath)) return;
58+
59+
//if sqfc exists, check if the sqf file has been updated (is newer). if not, skip this sqf file
60+
if (std::filesystem::exists(outputPath)) {
61+
auto sqfcWriteTime = std::filesystem::last_write_time(outputPath);
62+
auto sqfWriteTime = std::filesystem::last_write_time(path);
63+
if (sqfWriteTime <= sqfcWriteTime) //sqf file is older than sqfc
64+
return;
65+
}
6066

6167

6268
std::error_code ec;

0 commit comments

Comments
 (0)