diff options
| author | Dani Moncayo | 2014-11-08 22:17:00 +0100 |
|---|---|---|
| committer | Dani Moncayo | 2014-11-08 22:17:00 +0100 |
| commit | e7e61abaa9de9a7e8485d1fc52a5aa6ce112620e (patch) | |
| tree | 407f048f0ff3cd66af66c52a9b843781b95f3eb8 | |
| parent | 929201eab134620e5ef79211897c93ba90518122 (diff) | |
| download | emacs-e7e61abaa9de9a7e8485d1fc52a5aa6ce112620e.tar.gz emacs-e7e61abaa9de9a7e8485d1fc52a5aa6ce112620e.zip | |
build-aux/msys-to-w32: always output absolute paths.
| -rwxr-xr-x | build-aux/msys-to-w32 | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/build-aux/msys-to-w32 b/build-aux/msys-to-w32 index f8c37222889..1f9fda49fff 100755 --- a/build-aux/msys-to-w32 +++ b/build-aux/msys-to-w32 | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | #!/bin/bash | 1 | #!/bin/bash |
| 2 | # Convert a MSYS path list to Windows-native format. | 2 | # Convert a MSYS path list to absolute, Windows-native format. |
| 3 | # Status is zero if successful, nonzero otherwise. | 3 | # Status is zero if successful, nonzero otherwise. |
| 4 | 4 | ||
| 5 | # Copyright (C) 2013-2014 Free Software Foundation, Inc. | 5 | # Copyright (C) 2013-2014 Free Software Foundation, Inc. |
| @@ -25,20 +25,20 @@ usage="usage: ${me} PATHLIST" | |||
| 25 | help="$usage | 25 | help="$usage |
| 26 | or: ${me} OPTION | 26 | or: ${me} OPTION |
| 27 | 27 | ||
| 28 | Convert a MSYS path list to Windows-native format. | 28 | Convert a MSYS path list to absolute, Windows-native format. |
| 29 | 29 | ||
| 30 | PATHLIST should be a colon-separated list of MSYS paths, which will be | 30 | PATHLIST should be a colon-separated list of MSYS paths, which will be |
| 31 | written to the standard output after performing these transformations: | 31 | written to the standard output after performing these transformations: |
| 32 | 32 | ||
| 33 | 1. Discard empty paths. | 33 | 1. Discard empty paths. |
| 34 | 2. Replace: '\' with '/', '//' with '/' and ':' with ';'. | 34 | 2. Replace: '\' with '/', '//' with '/' and ':' with ';'. |
| 35 | 3. Translate each path to Windows-native format. | 35 | 3. Translate each path to absolute, Windows-native format. |
| 36 | 36 | ||
| 37 | Relative paths or paths starting with '%emacs_dir%' will be passed | 37 | Paths starting with '%emacs_dir%' will be passed verbatim to the |
| 38 | verbatim to the standard output. | 38 | standard output. |
| 39 | 39 | ||
| 40 | Each non existing absolute path will be translated by looking for its | 40 | Each non existing path will be translated by looking for its deepest |
| 41 | deepest existing directory, which will be translated and the remainder | 41 | existing directory, which will be translated and the remainder |
| 42 | appended. | 42 | appended. |
| 43 | 43 | ||
| 44 | Options: | 44 | Options: |
| @@ -81,9 +81,6 @@ do | |||
| 81 | if [ "${p:0:11}" = "%emacs_dir%" ] | 81 | if [ "${p:0:11}" = "%emacs_dir%" ] |
| 82 | then | 82 | then |
| 83 | w32p=$p | 83 | w32p=$p |
| 84 | elif [ "${p:0:1}" != "/" ] | ||
| 85 | then | ||
| 86 | w32p=$p | ||
| 87 | elif [ -d "$p" ] | 84 | elif [ -d "$p" ] |
| 88 | then | 85 | then |
| 89 | w32p=$(cd "$p" && pwd -W) | 86 | w32p=$(cd "$p" && pwd -W) |
| @@ -95,17 +92,23 @@ do | |||
| 95 | p=${p//\/\///} | 92 | p=${p//\/\///} |
| 96 | p=${p%/} | 93 | p=${p%/} |
| 97 | 94 | ||
| 98 | p1=$p | 95 | p1=$p # last candidate tried |
| 99 | while : | 96 | while : |
| 100 | do | 97 | do |
| 101 | p1=${p1%/*} | 98 | p2=${p1%/*} # next candidate to try |
| 102 | [ -z "$p1" ] && p1="/" && break | 99 | [ "$p2" = "$p1" ] && { |
| 103 | [ -d "$p1" ] && break | 100 | # No more candidates to try |
| 101 | echo "Invalid path '$p'." >&2 | ||
| 102 | exit 1 | ||
| 103 | } | ||
| 104 | [ -z "$p2" ] && p2="/" && break | ||
| 105 | [ -d "$p2" ] && break | ||
| 106 | p1=$p2 | ||
| 104 | done | 107 | done |
| 105 | 108 | ||
| 106 | # translate the existing part and append the rest | 109 | # translate the existing part and append the rest |
| 107 | w32p=$(cd "${p1}" && pwd -W) | 110 | w32p=$(cd "${p2}" && pwd -W) |
| 108 | remainder=${p#$p1} | 111 | remainder=${p#$p2} |
| 109 | w32p+=/${remainder#/} | 112 | w32p+=/${remainder#/} |
| 110 | fi | 113 | fi |
| 111 | 114 | ||