view mkinstalldirs @ 38651:683a60ba2533

These changes correct a corner case that the old code managed correctly. Precisely when you have a buffer visiting a file in the root directory and then revert it to a file with the same name in a different directory. (uniquify-fix-item-proposed): Renamed from uniquify-fix-item-min-proposed. (uniquify-set-proposed): New function. (uniquify-rationalize-file-buffer-names): Code reshuffled for clarity and speed. (uniquify-item-greaterp): Substitutes uniquify-item-lessp. This is equivalent to what the old code did. (uniquify-rationalize-a-list): Never recompute the proposed name. Sort the conflicting sublist before rationalising it: this is equivalent to what the old code did, but one directory element at a time, and only when necessary. (uniquify-rationalize-conflicting-sublist): Recompute here the proposed name.
author Francesco Potortì <pot@gnu.org>
date Wed, 01 Aug 2001 19:07:33 +0000
parents 774df19dd335
children f0eb34e60705 746c40973d25
line wrap: on
line source

#! /bin/sh
# mkinstalldirs --- make directory hierarchy
# Author: Noah Friedman <friedman@prep.ai.mit.edu>
# Created: 1993-05-16
# Public domain

# $Id: mkinstalldirs,v 1.1 2001/02/02 13:04:53 gerd Exp $

errstatus=0

for file
do
   set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
   shift

   pathcomp=
   for d
   do
     pathcomp="$pathcomp$d"
     case "$pathcomp" in
       -* ) pathcomp=./$pathcomp ;;
     esac

     if test ! -d "$pathcomp"; then
        echo "mkdir $pathcomp" 1>&2

        (mkdir "$pathcomp" && chmod a+rx "$pathcomp") || lasterr=$?

        if test ! -d "$pathcomp"; then
  	  errstatus=$lasterr
        fi
     fi

     pathcomp="$pathcomp/"
   done
done

exit $errstatus

# mkinstalldirs ends here