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 339f91b7e3SAndre 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 389f91b7e3SAndre Fischersub ToEscapedWindowsPath($) 39c9b362f6SAndre Fischer{ 40c9b362f6SAndre Fischer my ($path) = @_; 419f91b7e3SAndre Fischer 42c9b362f6SAndre Fischer my $windows_path = qx(cygpath -w "$path"); 43c9b362f6SAndre Fischer $windows_path =~ s/(^\s+|\s+$)//g; 44c9b362f6SAndre Fischer $windows_path =~ s/\\/\\\\/g; 459f91b7e3SAndre Fischer 469f91b7e3SAndre Fischer return $windows_path; 479f91b7e3SAndre Fischer} 489f91b7e3SAndre Fischer 499f91b7e3SAndre Fischer 509f91b7e3SAndre Fischer 519f91b7e3SAndre Fischer 529f91b7e3SAndre Fischersub ToWindowsPath ($) 539f91b7e3SAndre Fischer{ 549f91b7e3SAndre Fischer my ($path) = @_; 559f91b7e3SAndre Fischer 569f91b7e3SAndre Fischer my $windows_path = qx(cygpath -w "$path"); 579f91b7e3SAndre Fischer $windows_path =~ s/(^\s+|\s+$)//g; 589f91b7e3SAndre Fischer 59c9b362f6SAndre Fischer return $windows_path; 60c9b362f6SAndre Fischer} 61c9b362f6SAndre Fischer 62*677600b0SAndre Fischer 63*677600b0SAndre Fischer# TODO: Is there a touch in a standard library? 64*677600b0SAndre Fischersub touch ($) 65*677600b0SAndre Fischer{ 66*677600b0SAndre Fischer my ($filename) = @_; 67*677600b0SAndre Fischer 68*677600b0SAndre Fischer open my $out, ">", $filename; 69*677600b0SAndre Fischer close $out; 70*677600b0SAndre Fischer} 71*677600b0SAndre Fischer 72*677600b0SAndre Fischer 73*677600b0SAndre Fischer 74*677600b0SAndre Fischer 75*677600b0SAndre Fischer 76c9b362f6SAndre Fischer1; 77