SCons: Don't regenerate icons if not changes

This is rather a handbook example how NOT to do things in SCons, ideally
it should be official SCons target so all the dependencies and source file
modification stops being our worry. Especially since for CMake we already
do have an app to do generate all the data.

I don't have time to clean this up now but this constant icons regeneration
just pisses me off atm.
This commit is contained in:
2014-12-25 19:13:51 +05:00
parent c1f54bcdcc
commit 30e3aa1561

View File

@@ -113,6 +113,17 @@ def icondir_to_png(path_src, file_dst):
files = [os.path.join(path_src, f) for f in os.listdir(path_src) if f.endswith(".dat")]
# First check if we need to bother.
if os.path.exists(file_dst):
dst_time = os.path.getmtime(file_dst)
has_newer = False
for f in files:
if os.path.getmtime(f) > dst_time:
has_newer = True
break
if not has_newer:
return
with open(files[0], 'rb') as f_src:
(icon_w, icon_h,
orig_x, orig_y,