Version 1.2.0
[wimlib] / tests / tests-common.sh
1 srcdir="${srcdir:-.}/.."
2 srcdir="$(cd $srcdir; pwd)"
3
4 if stat -c %i . &> /dev/null ; then
5         BSD_STAT=0
6 else
7         BSD_STAT=1
8 fi
9
10 get_inode_number()
11 {
12         if [ "$BSD_STAT" -eq 1 ]; then
13                 stat -f %i "$1"
14         else
15                 stat -c %i "$1"
16         fi
17 }
18
19 get_link_count()
20 {
21         if [ "$BSD_STAT" -eq 1 ]; then
22                 stat -f %l "$1"
23         else
24                 stat -c %h "$1"
25         fi
26 }
27
28 get_file_size()
29 {
30         if [ "$BSD_STAT" -eq 1 ]; then
31                 stat -f %z "$1"
32         else
33                 stat -c %s "$1"
34         fi
35 }