]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
Create directories as needed.
authorBruno Haible <bruno@clisp.org>
Fri, 3 May 2002 18:53:52 +0000 (18:53 +0000)
committerBruno Haible <bruno@clisp.org>
Tue, 23 Jun 2009 10:07:57 +0000 (12:07 +0200)
misc/ChangeLog
misc/autopoint.in

index db7e38cae1262062d29911afd5597afa2bf7caa1..219829be06862e3eca50d728379ea0985b222f5a 100644 (file)
@@ -2,6 +2,8 @@
 
        * autopoint.in: Unset all other environment variables which influence
        cvs. Pass -d $CVSROOT explicitly.
+       (func_mkdir_for): New function.
+       (func_copy): Call it.
 
 2002-05-01  Bruno Haible  <bruno@clisp.org>
 
index 57735358ea5eedb74ff77e9006fb2bb7a6f5ae00..a3d5aef4a508bc7b95405e70698003ad3e46850b 100644 (file)
@@ -308,6 +308,20 @@ if test -z "$force"; then
   fi
 fi
 
+# func_mkdir_for to
+# ensures the directory that would the given file exists.
+# 'to' is a relative pathname, relative to the current directory.
+func_mkdir_for ()
+{
+  base=`echo "$1" | sed -e 's,/[^/]*$,,'`
+  if test "X$base" != "X$1" && test -n "$base"; then
+    func_mkdir_for "$base"
+    # Recompute base. It was clobbered by the recursive call.
+    base=`echo "$1" | sed -e 's,/[^/]*$,,'`
+    test -d "$base" || { echo "Creating directory $base"; mkdir "$base"; }
+  fi
+}
+
 # func_copy from to
 # copies a file.
 # 'from' is a relative pathname, relative to the current directory.
@@ -315,6 +329,7 @@ fi
 func_copy ()
 {
   if $doit; then
+    func_mkdir_for "$2"
     rm -f "$2"
     echo "Copying file $2"
     cp "$1" "$2"