xref: /AOO41X/main/solenv/bin/modules/installer/patch/Tools.pm (revision 9f91b7e30577a5efd4c1ce7f0c95f4b60745abda)
1c9b362f6SAndre Fischer#**************************************************************
2c9b362f6SAndre Fischer#
3c9b362f6SAndre Fischer#  Licensed to the Apache Software Foundation (ASF) under one
4c9b362f6SAndre Fischer#  or more contributor license agreements.  See the NOTICE file
5c9b362f6SAndre Fischer#  distributed with this work for additional information
6c9b362f6SAndre Fischer#  regarding copyright ownership.  The ASF licenses this file
7c9b362f6SAndre Fischer#  to you under the Apache License, Version 2.0 (the
8c9b362f6SAndre Fischer#  "License"); you may not use this file except in compliance
9c9b362f6SAndre Fischer#  with the License.  You may obtain a copy of the License at
10c9b362f6SAndre Fischer#
11c9b362f6SAndre Fischer#    http://www.apache.org/licenses/LICENSE-2.0
12c9b362f6SAndre Fischer#
13c9b362f6SAndre Fischer#  Unless required by applicable law or agreed to in writing,
14c9b362f6SAndre Fischer#  software distributed under the License is distributed on an
15c9b362f6SAndre Fischer#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16c9b362f6SAndre Fischer#  KIND, either express or implied.  See the License for the
17c9b362f6SAndre Fischer#  specific language governing permissions and limitations
18c9b362f6SAndre Fischer#  under the License.
19c9b362f6SAndre Fischer#
20c9b362f6SAndre Fischer#**************************************************************
21c9b362f6SAndre Fischer
22c9b362f6SAndre Fischerpackage installer::patch::Tools;
23c9b362f6SAndre Fischer
24c9b362f6SAndre Fischer=head1 NAME
25c9b362f6SAndre Fischer
26c9b362f6SAndre Fischer    package installer::patch::Tools - Collection of functions that don't fit anywhere else
27c9b362f6SAndre Fischer
28c9b362f6SAndre Fischer=cut
29c9b362f6SAndre Fischer
30c9b362f6SAndre Fischer
31c9b362f6SAndre Fischer
32c9b362f6SAndre Fischer
33*9f91b7e3SAndre Fischer=head2 ToEscapedWindowsPath ($path)
34c9b362f6SAndre Fischer
35c9b362f6SAndre Fischer    Convert the given path with the 'cygpath' command into Windows format.  Quote backslashes.
36c9b362f6SAndre Fischer
37c9b362f6SAndre Fischer=cut
38*9f91b7e3SAndre Fischersub ToEscapedWindowsPath($)
39c9b362f6SAndre Fischer{
40c9b362f6SAndre Fischer    my ($path) = @_;
41*9f91b7e3SAndre Fischer
42c9b362f6SAndre Fischer    my $windows_path = qx(cygpath -w "$path");
43c9b362f6SAndre Fischer    $windows_path =~ s/(^\s+|\s+$)//g;
44c9b362f6SAndre Fischer    $windows_path =~ s/\\/\\\\/g;
45*9f91b7e3SAndre Fischer
46*9f91b7e3SAndre Fischer    return $windows_path;
47*9f91b7e3SAndre Fischer}
48*9f91b7e3SAndre Fischer
49*9f91b7e3SAndre Fischer
50*9f91b7e3SAndre Fischer
51*9f91b7e3SAndre Fischer
52*9f91b7e3SAndre Fischersub ToWindowsPath ($)
53*9f91b7e3SAndre Fischer{
54*9f91b7e3SAndre Fischer    my ($path) = @_;
55*9f91b7e3SAndre Fischer
56*9f91b7e3SAndre Fischer    my $windows_path = qx(cygpath -w "$path");
57*9f91b7e3SAndre Fischer    $windows_path =~ s/(^\s+|\s+$)//g;
58*9f91b7e3SAndre Fischer
59c9b362f6SAndre Fischer    return $windows_path;
60c9b362f6SAndre Fischer}
61c9b362f6SAndre Fischer
62c9b362f6SAndre Fischer1;
63