X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/e7e61abaa9de9a7e8485d1fc52a5aa6ce112620e..d16fb740912bf4874e7087f6f419427516047977:/build-aux/msys-to-w32 diff --git a/build-aux/msys-to-w32 b/build-aux/msys-to-w32 index 1f9fda49ff..f8a0a81b9f 100755 --- a/build-aux/msys-to-w32 +++ b/build-aux/msys-to-w32 @@ -1,8 +1,8 @@ #!/bin/bash -# Convert a MSYS path list to absolute, Windows-native format. +# Convert a MSYS path list to Windows-native format. # Status is zero if successful, nonzero otherwise. -# Copyright (C) 2013-2014 Free Software Foundation, Inc. +# Copyright (C) 2013-2015 Free Software Foundation, Inc. # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -25,21 +25,14 @@ usage="usage: ${me} PATHLIST" help="$usage or: ${me} OPTION -Convert a MSYS path list to absolute, Windows-native format. +Convert a MSYS path list to Windows-native format. PATHLIST should be a colon-separated list of MSYS paths, which will be written to the standard output after performing these transformations: 1. Discard empty paths. 2. Replace: '\' with '/', '//' with '/' and ':' with ';'. -3. Translate each path to absolute, Windows-native format. - -Paths starting with '%emacs_dir%' will be passed verbatim to the -standard output. - -Each non existing path will be translated by looking for its deepest -existing directory, which will be translated and the remainder -appended. +3. Translate absolute paths to Windows-native format. Options: --help display this help and exit @@ -78,7 +71,7 @@ for p do [ -z "$p" ] && continue - if [ "${p:0:11}" = "%emacs_dir%" ] + if [ "${p:0:1}" != "/" ] then w32p=$p elif [ -d "$p" ] @@ -92,23 +85,17 @@ do p=${p//\/\///} p=${p%/} - p1=$p # last candidate tried + p1=$p while : do - p2=${p1%/*} # next candidate to try - [ "$p2" = "$p1" ] && { - # No more candidates to try - echo "Invalid path '$p'." >&2 - exit 1 - } - [ -z "$p2" ] && p2="/" && break - [ -d "$p2" ] && break - p1=$p2 + p1=${p1%/*} + [ -z "$p1" ] && p1="/" && break + [ -d "$p1" ] && break done # translate the existing part and append the rest - w32p=$(cd "${p2}" && pwd -W) - remainder=${p#$p2} + w32p=$(cd "${p1}" && pwd -W) + remainder=${p#$p1} w32p+=/${remainder#/} fi