upped version number, corrected error in conditional.
[feisty_meow.git] / scripts / generator / wrapdoze.sh
1 #!/bin/bash
2
3 source $FEISTY_MEOW_SCRIPTS/core/functions.sh
4
5 function dossify_and_run_commands()
6 {
7   # we only mess with the command line on windows...
8   if [ "$OS" != "Windows_NT" ]; then
9     # for non windows, just run the commands straight up.
10     $*
11     return $?
12   fi
13
14   declare -a darc_commands=()
15
16   for i in "$@"; do
17     if [[ "$i" =~ ^-[a-zA-z][/\"].* ]]; then
18 echo found parameter to fix...
19       flag="${i:0:2}"
20       filename="$(unix_to_dos_path ${i:2})"
21 echo "first two chars are $flag"
22 echo "last after that are $filename"
23       recombined="$flag$filename"
24 echo combined flag and file is $recombined
25       darc_commands+=("$recombined")
26     else 
27       darc_commands+=($(unix_to_dos_path $i))
28     fi
29   done
30
31   declare -a real_commands=()
32   for i in "${darc_commands[@]}"; do
33     real_commands+=($(echo $i | sed -e 's/\\/\\\\/g'))
34   done
35
36 #temp!
37   echo commands are now: >>/tmp/wrapdoze.log
38   for i in "${real_commands[@]}"; do
39     echo $i >>/tmp/wrapdoze.log
40   done
41 #end temp
42
43   # now actually run the chewed command.
44   cmd /c "${real_commands[@]}"
45 }
46
47 dossify_and_run_commands "$@"
48