1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-15 15:49:56 +00:00
openmw-tes3mp/apps/niftest/find_bad_nifs.sh
Arthur Moore 2a653e45fd (Re) Wrote a tool to test NIF files in BSAs and on the filesystem.
Just give it a set of files, one file per argument, and it will make sure openmw can read them.
2015-07-28 06:51:47 -04:00

28 lines
778 B
Bash
Executable file

#!/bin/bash
#Script to test all nif files (both loose, and in BSA archives) in data files directory
#The user input as an absolute path
DATAFILESDIR="`readlink -m "$1"`"
#Program used to test
TEST_PROG="`pwd`/niftest"
#Make sure our files don't bother anyone
NIFTEST_TMP_DIR="/tmp/niftest_$RANDOM/"
mkdir "$NIFTEST_TMP_DIR"
cd "$NIFTEST_TMP_DIR"
find "$DATAFILESDIR" -iname *bsa > nifs.txt
find "$DATAFILESDIR" -iname *nif >> nifs.txt
sed -e 's/.*/\"&\"/' nifs.txt > quoted_nifs.txt
xargs --arg-file=quoted_nifs.txt "$TEST_PROG" 2>&1 | tee nif_out.txt
# xargs --arg-file=quoted_nifs.txt "$TEST_PROG" 2> nif_out.txt >/dev/null
echo "List of bad NIF Files:"
cat nif_out.txt|grep File:|cut -d ' ' -f 2-
rm nifs.txt
rm quoted_nifs.txt
rm nif_out.txt
rmdir "$NIFTEST_TMP_DIR"