summaryrefslogtreecommitdiff
path: root/apps/examples/nxflat/tests/mkdirlist.sh
blob: cc55ac0b56a535a8f471babf4768104f39971d24 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/bash

usage="Usage: %0 <romfs-dir-path>"

dir=$1
if [ -z "$dir" ]; then
	echo "ERROR: Missing <romfs-dir-path>"
	echo ""
	echo $usage
	exit 1
fi

if [ ! -d "$dir" ]; then
	echo "ERROR: Directory $dir does not exist"
	echo ""
	echo $usage
	exit 1
fi

echo "#ifndef __EXAMPLES_NXFLAT_TESTS_DIRLIST_H"
echo "#define __EXAMPLES_NXFLAT_TESTS_DIRLIST_H"
echo ""
echo "static const char *dirlist[] ="
echo "{"

for file in `ls $dir`; do
	echo "  \"$file\","
done

echo "  NULL"
echo "};"
echo ""
echo "#endif /* __EXAMPLES_NXFLAT_TESTS_DIRLIST_H */"