19f91b7e3SAndre Fischer#************************************************************** 29f91b7e3SAndre Fischer# 39f91b7e3SAndre Fischer# Licensed to the Apache Software Foundation (ASF) under one 49f91b7e3SAndre Fischer# or more contributor license agreements. See the NOTICE file 59f91b7e3SAndre Fischer# distributed with this work for additional information 69f91b7e3SAndre Fischer# regarding copyright ownership. The ASF licenses this file 79f91b7e3SAndre Fischer# to you under the Apache License, Version 2.0 (the 89f91b7e3SAndre Fischer# "License"); you may not use this file except in compliance 99f91b7e3SAndre Fischer# with the License. You may obtain a copy of the License at 109f91b7e3SAndre Fischer# 119f91b7e3SAndre Fischer# http://www.apache.org/licenses/LICENSE-2.0 129f91b7e3SAndre Fischer# 139f91b7e3SAndre Fischer# Unless required by applicable law or agreed to in writing, 149f91b7e3SAndre Fischer# software distributed under the License is distributed on an 159f91b7e3SAndre Fischer# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 169f91b7e3SAndre Fischer# KIND, either express or implied. See the License for the 179f91b7e3SAndre Fischer# specific language governing permissions and limitations 189f91b7e3SAndre Fischer# under the License. 199f91b7e3SAndre Fischer# 209f91b7e3SAndre Fischer#************************************************************** 219f91b7e3SAndre Fischer 229f91b7e3SAndre Fischerpackage installer::patch::Tools; 239f91b7e3SAndre Fischer 249f91b7e3SAndre Fischer=head1 NAME 259f91b7e3SAndre Fischer 269f91b7e3SAndre Fischer package installer::patch::Tools - Collection of functions that don't fit anywhere else 279f91b7e3SAndre Fischer 289f91b7e3SAndre Fischer=cut 299f91b7e3SAndre Fischer 309f91b7e3SAndre Fischer 319f91b7e3SAndre Fischer 329f91b7e3SAndre Fischer 339f91b7e3SAndre Fischer=head2 ToEscapedWindowsPath ($path) 349f91b7e3SAndre Fischer 359f91b7e3SAndre Fischer Convert the given path with the 'cygpath' command into Windows format. Quote backslashes. 369f91b7e3SAndre Fischer 379f91b7e3SAndre Fischer=cut 389f91b7e3SAndre Fischersub ToEscapedWindowsPath($) 399f91b7e3SAndre Fischer{ 409f91b7e3SAndre Fischer my ($path) = @_; 419f91b7e3SAndre Fischer 429f91b7e3SAndre Fischer my $windows_path = qx(cygpath -w "$path"); 439f91b7e3SAndre Fischer $windows_path =~ s/(^\s+|\s+$)//g; 449f91b7e3SAndre 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 599f91b7e3SAndre Fischer return $windows_path; 609f91b7e3SAndre Fischer} 619f91b7e3SAndre 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 769f91b7e3SAndre Fischer1; 77