bump product version to 4.1.6.2
[LibreOffice.git] / solenv / bin / mkdir.pl
bloba3bf01015dc4eac0384aa16aa2662f444bc022ef
1 : # -*- perl -*-
2 eval 'exec perl -wS $0 ${1+"$@"}'
3 if 0;
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)
26 # -mode mode
29 use Cwd;
31 $currdir = cwd;
33 $MODE = 00777 ;
35 while ( $#ARGV >= 0 ) {
36 if ( $ARGV[0] eq "-mode" ) {
37 $MODE = oct $ARGV[1] ;
38 shift @ARGV ;
39 shift @ARGV ;
41 elsif ( $ARGV[0] eq "-p" ) {
42 shift @ARGV ;
43 # -p does not do anything, it's supported just for compatibility
45 else {
47 $ARGV[0] =~ s?\\|:?/?g ;
48 @SUBDIRS = split "/", $ARGV[0] ;
50 # absolute path UNIX
51 if ( $SUBDIRS[0] eq "" ) {
52 chdir '/' ;
53 shift @SUBDIRS ;
55 # absolute path WINDOWS
56 if ( $#SUBDIRS > 1 ) {
57 if ( $SUBDIRS[1] eq "" ) {
58 if ( $SUBDIRS[0] =~ /\w/ ) {
59 chdir "$SUBDIRS[0]:\\" ;
60 shift @SUBDIRS ;
61 shift @SUBDIRS ;
62 } ;
63 } ;
66 while (@SUBDIRS) {
67 if ( -e $SUBDIRS[0] ) {
68 if ( ! -d $SUBDIRS[0] ) {
69 die "file exists\n"
72 else {
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]" ;
76 shift @SUBDIRS ;
77 } ;
79 shift @ARGV ;
80 } ;
81 chdir $currdir;