From 707df3d10b446184f7ff9bac52c70bab4491ee1a Mon Sep 17 00:00:00 2001 From: Veloman Yunkan Date: Sun, 27 Feb 2022 20:25:41 +0400 Subject: [PATCH] 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. --- scripts/kiwix-resources | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/kiwix-resources b/scripts/kiwix-resources index 08295c38..9bcfbda8 100755 --- a/scripts/kiwix-resources +++ b/scripts/kiwix-resources @@ -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)