2 eval 'exec perl -wS $0 ${1+"$@"}'
6 # This file is part of the LibreOffice project.
8 # This Source Code Form is subject to the terms of the Mozilla Public
9 # License, v. 2.0. If a copy of the MPL was not distributed with this
10 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
12 # This file incorporates work covered by the following license notice:
14 # Licensed to the Apache Software Foundation (ASF) under one or more
15 # contributor license agreements. See the NOTICE file distributed
16 # with this work for additional information regarding copyright
17 # ownership. The ASF licenses this file to you under the Apache
18 # License, Version 2.0 (the "License"); you may not use this file
19 # except in compliance with the License. You may obtain a copy of
20 # the License at http://www.apache.org/licenses/LICENSE-2.0 .
23 # mkdir - a perl script to substitute mkdir -p
24 # accepts "/", ":", and "\" as delimiters of subdirectories
25 # options -p (for compatibility)
35 while ( $#ARGV >= 0 ) {
36 if ( $ARGV[0] eq "-mode" ) {
37 $MODE = oct $ARGV[1] ;
41 elsif ( $ARGV[0] eq "-p" ) {
43 # -p does not do anything, it's supported just for compatibility
47 $ARGV[0] =~ s?
\\|:?
/?g
;
48 @SUBDIRS = split "/", $ARGV[0] ;
51 if ( $SUBDIRS[0] eq "" ) {
55 # absolute path WINDOWS
56 if ( $#SUBDIRS > 1 ) {
57 if ( $SUBDIRS[1] eq "" ) {
58 if ( $SUBDIRS[0] =~ /\w/ ) {
59 chdir "$SUBDIRS[0]:\\" ;
67 if ( -e
$SUBDIRS[0] ) {
68 if ( ! -d
$SUBDIRS[0] ) {
73 mkdir $SUBDIRS[0], $MODE or die "Can't create directory $SUBDIRS[0]"
75 chdir $SUBDIRS[0] or die "Can't cd to $SUBDIRS[0]" ;