Bug fixed for unix error "readlink /proc/self/fd/0" on MacOS.
[Faustine.git] / interpreter / preprocessor / faust-0.9.47mr3 / tools / faust2appls / faust2sigviewer
1 #!/bin/bash
2
3 # Usage.
4 print_usage()
5 {
6 echo Usage : args of faust2graphviewer should be a \'.dsp\' file, or a list of \'.dsp\' files.
7 }
8
9
10 # prepare how we are going to open .pdf files
11 if [[ $(uname) == Darwin ]]; then
12 OPEN=open
13 else
14 OPEN=xdg-open
15 fi
16
17
18
19 # Main loop of this script :
20 for FILEPATH in $@ ; do
21 if [ -f $FILEPATH ] ; then
22 FILENAME=`basename $FILEPATH` &&
23 case $FILENAME in
24 *.dsp )
25 faust -o /dev/null -sg $FILEPATH &&
26 dot -Tpdf $FILEPATH-sig.dot -o ${FILEPATH%.dsp}-sig.pdf &&
27 rm $FILEPATH-sig.dot &&
28 ${OPEN} ${FILEPATH%.dsp}-sig.pdf
29 ;;
30 * )
31 echo error : \'$FILEPATH\' does not have a \'.dsp\' extension.
32 exit 2
33 ;;
34 esac
35 else
36 print_usage
37 exit 1
38 fi
39 done
40 exit 0
41