emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r118323: build-aux/msys-to-w32: always output absolu


From: Dani Moncayo
Subject: [Emacs-diffs] trunk r118323: build-aux/msys-to-w32: always output absolute paths.
Date: Sat, 08 Nov 2014 21:17:26 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 118323
revision-id: address@hidden
parent: address@hidden
committer: Dani Moncayo <address@hidden>
branch nick: trunk
timestamp: Sat 2014-11-08 22:17:00 +0100
message:
  build-aux/msys-to-w32: always output absolute paths.
modified:
  build-aux/msys-to-w32          msystow32-20131120014415-6qbja8232hbv7kxz-1
=== modified file 'build-aux/msys-to-w32'
--- a/build-aux/msys-to-w32     2014-11-08 15:27:34 +0000
+++ b/build-aux/msys-to-w32     2014-11-08 21:17:00 +0000
@@ -1,5 +1,5 @@
 #!/bin/bash
-# Convert a MSYS path list to Windows-native format.
+# Convert a MSYS path list to absolute, Windows-native format.
 # Status is zero if successful, nonzero otherwise.
 
 # Copyright (C) 2013-2014 Free Software Foundation, Inc.
@@ -25,20 +25,20 @@
 help="$usage
   or:  ${me} OPTION
 
-Convert a MSYS path list to Windows-native format.
+Convert a MSYS path list to absolute, 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 Windows-native format.
-
-Relative paths or paths starting with '%emacs_dir%' will be passed
-verbatim to the standard output.
-
-Each non existing absolute path will be translated by looking for its
-deepest existing directory, which will be translated and the remainder
+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.
 
 Options:
@@ -81,9 +81,6 @@
     if [ "${p:0:11}" = "%emacs_dir%" ]
     then
        w32p=$p
-    elif [ "${p:0:1}" != "/" ]
-    then
-       w32p=$p
     elif [ -d "$p" ]
     then
        w32p=$(cd "$p" && pwd -W)
@@ -95,17 +92,23 @@
        p=${p//\/\///}
        p=${p%/}
 
-       p1=$p
+       p1=$p # last candidate tried
        while :
        do
-           p1=${p1%/*}
-           [ -z "$p1" ] && p1="/" && break
-           [ -d "$p1" ] && break
+           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
        done
 
        # translate the existing part and append the rest
-       w32p=$(cd "${p1}" && pwd -W)
-       remainder=${p#$p1}
+       w32p=$(cd "${p2}" && pwd -W)
+       remainder=${p#$p2}
        w32p+=/${remainder#/}
     fi
 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]