Gating network behind compile flag
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
import os
|
||||
|
||||
def write_if_changed(path, content):
|
||||
try:
|
||||
with open(path, "r", encoding="utf-8") as f:
|
||||
if f.read() == content:
|
||||
return
|
||||
except FileNotFoundError:
|
||||
pass
|
||||
|
||||
os.makedirs(os.path.dirname(path), exist_ok=True)
|
||||
with open(path, "w", encoding="utf-8") as f:
|
||||
f.write(content)
|
||||
Reference in New Issue
Block a user