diff options
| author | Yong He <yonghe@outlook.com> | 2020-09-02 13:32:53 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-09-02 13:32:53 -0700 |
| commit | 44929d9406cbf592e1c1e09669245192d6d1bd69 (patch) | |
| tree | 388f9f0ad768d80ad5d4e4cddd754178925a54e6 /tools/slang-cpp-extractor/slang-cpp-extractor-main.cpp | |
| parent | a2a7c4d988b2b7126130d9dcbe4ec94e1ce8424b (diff) | |
[slang-cpp-extractor] Don't modify generated source if there is no change. (#1530)
Diffstat (limited to 'tools/slang-cpp-extractor/slang-cpp-extractor-main.cpp')
| -rw-r--r-- | tools/slang-cpp-extractor/slang-cpp-extractor-main.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tools/slang-cpp-extractor/slang-cpp-extractor-main.cpp b/tools/slang-cpp-extractor/slang-cpp-extractor-main.cpp index 96df8ec4b..d2f83f53e 100644 --- a/tools/slang-cpp-extractor/slang-cpp-extractor-main.cpp +++ b/tools/slang-cpp-extractor/slang-cpp-extractor-main.cpp @@ -1924,6 +1924,15 @@ SlangResult CPPExtractorApp::writeAllText(const Slang::String& fileName, const U { try { + if (File::exists(fileName)) + { + String existingText; + if (readAllText(fileName, existingText) == SLANG_OK) + { + if (existingText == text) + return SLANG_OK; + } + } StreamWriter writer(new FileStream(fileName, FileMode::Create)); writer.Write(text); } |
