mirror of https://github.com/kiwix/libkiwix.git
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:
parent
c016dfd2ce
commit
707df3d10b
|
@ -88,6 +88,8 @@ def preprocess_resource(srcdir, resource_path, outdir):
|
||||||
os.makedirs(os.path.join(outdir, resource_dir), exist_ok=True)
|
os.makedirs(os.path.join(outdir, resource_dir), exist_ok=True)
|
||||||
srcpath = os.path.join(srcdir, resource_path)
|
srcpath = os.path.join(srcdir, resource_path)
|
||||||
outpath = os.path.join(outdir, 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)
|
preprocessed_content, modified_line_count = get_preprocessed_resource(srcpath)
|
||||||
if modified_line_count == 0:
|
if modified_line_count == 0:
|
||||||
symlink_resource(srcpath, outpath)
|
symlink_resource(srcpath, outpath)
|
||||||
|
|
Loading…
Reference in New Issue