summaryrefslogtreecommitdiff
path: root/Tools/convertpath
blob: fce5ac24b06efc1e345db14da1c5f7b3ebf54880 (plain)
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
#!/bin/sh

# Unix to Windows relative path conversion in a script.
# Useful for avoiding backslash quoting difficulties in Makefiles.
# Acts as a much dumbed down 'cygpath -w' tool.

usage()
{
  cat <<EOF
Usage: $0 [-w|-u|-h] [path]...

Convert Windows and Unix paths (intended for simple relative paths only)

  -w  Convert backslashes to forward slashes in the paths
  -u  Convert forward slashes to backslashes in the paths
EOF
}

option="$1"
case "$option" in
  -w) shift; echo $@ | sed -e 's,/,\\,g' ;;
  -u) shift; echo $@ | sed -e 's,\\,/,g' ;;
  -h) shift; usage; ;;
  *) usage; exit 1 ;;
esac

exit 0