]>
code.delx.au - gnu-emacs/blob - build-aux/msys-to-w32
2 # Take a list of MSYS-compatible paths and convert them to native
4 # Status is zero if successful, nonzero otherwise.
6 # Copyright (C) 2013-2014 Free Software Foundation, Inc.
8 # This program is free software: you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation, either version 3 of the License, or
11 # (at your option) any later version.
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program. If not, see <http://www.gnu.org/licenses/>.
21 # Take only the basename from the full pathname
24 usage
="usage: ${me} PATHLIST"
29 Convert a MSYS path list to Windows-native format.
31 PATHLIST should be a colon-separated list of MSYS paths, which will be
32 written to the standard output after performing these transformations:
34 1. Discard empty paths.
35 2. Replace: '\' with '/', '//' with '/' and ':' with ';'.
36 3. Translate each path to Windows-native format.
38 Relative paths or paths starting with '%emacs_dir%' will be passed
39 verbatim to the standard output.
41 Each non existing absolute paths will be translated by looking for its
42 deepest existing directory, which will be translated and the remainder
46 --help display this help and exit
48 Report bugs to <bug-gnu-emacs@gnu.org>."
53 --help |
--hel |
--he |
--h)
59 echo "${me}: invalid option: $arg" >&2
67 echo "${me}: $usage" >&2
73 # Put each MSYS path in one positional parameter and iterate through
80 [ -z "$p" ] && continue
82 if [ "${p:0:11}" = "%emacs_dir%" ]
85 elif [ "${p:0:1}" != "/" ]
90 w32p
=$
(cd "$p" && pwd -W)
92 # Make some cleanup in the path and look for its deepest
103 [ -z "$p1" ] && p1
="/" && break
104 [ -d "$p1" ] && break
107 # translate the existing part and append the rest
108 w32p
=$
(cd "${p1}" && pwd -W)
110 w32p
+=/${remainder#/}
113 w32pathlist
="${w32pathlist};${w32p}"
117 echo "${w32pathlist:1}"