summaryrefslogtreecommitdiff
path: root/Meta/lint-missing-resources.sh
diff options
context:
space:
mode:
authorBen Wiederhake <BenWiederhake.GitHub@gmx.de>2020-07-27 06:33:48 +0200
committerAndreas Kling <kling@serenityos.org>2020-07-29 01:34:22 +0200
commiteccf96b703d52aa0b392afe92eb4aef859ef1776 (patch)
tree2dc07d132ef54b970af5ca041afe75e132706f85 /Meta/lint-missing-resources.sh
parent5692fa6c3938d8e49c3ad4b5c82d0eabead1f419 (diff)
downloadserenity-eccf96b703d52aa0b392afe92eb4aef859ef1776.zip
Meta: Find potentially missing resources
Diffstat (limited to 'Meta/lint-missing-resources.sh')
-rwxr-xr-xMeta/lint-missing-resources.sh18
1 files changed, 18 insertions, 0 deletions
diff --git a/Meta/lint-missing-resources.sh b/Meta/lint-missing-resources.sh
new file mode 100755
index 0000000000..fa8646bc98
--- /dev/null
+++ b/Meta/lint-missing-resources.sh
@@ -0,0 +1,18 @@
+#!/bin/sh
+set -e pipefail
+
+script_path=$(cd -P -- "$(dirname -- "$0")" && pwd -P)
+cd "$script_path/.."
+
+# The dollar symbol in sed's argument is for "end of line", not any shell variable.
+# shellcheck disable=SC2016
+grep -Pirh '(?<!file://)(?<!\.)(?<!})(?<!\()/(etc|res|usr|www)/' AK/ Applications/ Base Demos/ DevTools/ Documentation/ Games/ Kernel/ Libraries/ MenuApplets/ Services/ Shell/ Userland/ | \
+sed -re 's,^.*["= `]/([^"%`: ]+[^"%`: /.])/?(["%`: .].*)?$,\1,' | \
+sort -u | \
+while read -r referenced_resource
+do
+ if ! [ -r "Base/${referenced_resource}" ] && ! [ -r "Build/Root/${referenced_resource}" ]
+ then
+ echo "Potentially missing resource: ${referenced_resource}"
+ fi
+done