nice changes unified a bunch of things, although of course windows
[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
8
9 eval "${@}"
10 return $?
11
12
13 #all primordial gunk.  try above first.
14   # we only mess with the command line on windows...
15   if [ "$OS" != "Windows_NT" ]; then
16     # for non windows, just run the commands straight up.
17     $*
18     return $?
19   fi
20
21   declare -a darc_commands=()
22
23   for i in "$@"; do
24     if [[ "$i" =~ ^-[a-zA-z][/\"].* ]]; then
25       flag="${i:0:2}"
26       filename="$(unix_to_dos_path ${i:2})"
27 #echo "first two chars are $flag"
28 #echo "last after that are $filename"
29       recombined="$flag$filename"
30 #echo combined flag and file is $recombined
31       darc_commands+=("$recombined")
32     else 
33       darc_commands+=($(unix_to_dos_path $i))
34     fi
35   done
36
37   declare -a real_commands=()
38   for i in "${darc_commands[@]}"; do
39     real_commands+=($(echo $i | sed -e 's/\\/\\\\/g'))
40   done
41
42 #temp!
43   echo commands are now:
44   for i in "${real_commands[@]}"; do
45     echo -n "$i "
46   done
47   echo
48 #end temp
49
50   # now actually run the chewed command.
51   cmd /c "${real_commands[@]}"
52 }
53
54 dossify_and_run_commands "$@"
55