mirror of
https://github.com/kiwix/libkiwix.git
synced 2025-06-26 10:11:30 +00:00
Removing the old preprocessed resource, if any
If during an earlier build a resource was symlinked in the build directory (because it wasn't modified by preprocessing) and later changes are made to the resource that result in its preprocessing no longer being a no-op, then the preprocessing is performed (in place) on the original resource directly (via the symlink). Therefore any symlinks must be removed before preprocessing a resource.
This commit is contained in:
@ -88,6 +88,8 @@ def preprocess_resource(srcdir, resource_path, outdir):
|
||||
os.makedirs(os.path.join(outdir, resource_dir), exist_ok=True)
|
||||
srcpath = os.path.join(srcdir, resource_path)
|
||||
outpath = os.path.join(outdir, resource_path)
|
||||
if os.path.exists(outpath):
|
||||
os.remove(outpath)
|
||||
preprocessed_content, modified_line_count = get_preprocessed_resource(srcpath)
|
||||
if modified_line_count == 0:
|
||||
symlink_resource(srcpath, outpath)
|
||||
|
Reference in New Issue
Block a user