summaryrefslogtreecommitdiff
path: root/solenv/bin/guw.pl
diff options
context:
space:
mode:
authorJens-Heiner Rechtien <hr@openoffice.org>2004-03-09 11:19:01 +0000
committerJens-Heiner Rechtien <hr@openoffice.org>2004-03-09 11:19:01 +0000
commite5033c0c3ff7d1522951f36396e254a6edc6020a (patch)
tree9cd972a3130ecce7c497296246435609236b96a0 /solenv/bin/guw.pl
parentd4d1c68e141f5c9857101a0e24af40100c98f389 (diff)
INTEGRATION: CWS ooo20040225 (1.13.4); FILE MERGED
2004/02/21 01:50:08 vq 1.13.4.2: #25499 2nd part of guw.pl patch. 2004/02/18 02:23:06 vq 1.13.4.1: #25499 Teach guw.pl to handle something=<path> parameter and minor cleanup of the used regex.
Diffstat (limited to 'solenv/bin/guw.pl')
-rwxr-xr-xsolenv/bin/guw.pl37
1 files changed, 29 insertions, 8 deletions
diff --git a/solenv/bin/guw.pl b/solenv/bin/guw.pl
index 48a0fbce02de..36dc8751bcae 100755
--- a/solenv/bin/guw.pl
+++ b/solenv/bin/guw.pl
@@ -5,9 +5,9 @@ eval 'exec perl -wS $0 ${1+"$@"}'
#
# $RCSfile: guw.pl,v $
#
-# $Revision: 1.13 $
+# $Revision: 1.14 $
#
-# last change: $Author: hr $ $Date: 2004-02-04 12:36:59 $
+# last change: $Author: hr $ $Date: 2004-03-09 12:19:01 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
@@ -105,6 +105,7 @@ sub WinFormat {
$variable =~ s/(\$\w+)/$1/eeg ; # expand the variables twice!
$variable =~ s/:/;/g;
$variable =~ s/([;]|\A)(\w);/$1$2:/g; # get back the drives
+
# Search for posix path ;entry; and replace with cygpath -w entry, accept quotes.
while ( $variable =~ /(?:;|\A)[\'\"]?((?:\/[\w\.\- ~]+)+)[\'\"]?(?:;|\Z)/ ) { # Normal paths
if ( defined $debug ) { print(STDERR "WinFormat:\nnormal path:\n$variable\n");};
@@ -112,12 +113,24 @@ sub WinFormat {
chomp( $d2 = qx{cygpath -w "$d1"} ) ;
$variable =~ s/$d1/$d2/ ;
}
- if ( $variable =~ /\A(-\w(?:[\w\.]+=)?)[\'\"]?((?:\/[\w\.\- ~]+)+\/?)[\'\"]?\Z/ ) { # Include paths (sometimes with "/" at the end)
- # This regex: option -> $1, filename without quotes -> $2
- # option may be of the form -X<path> or -X<something>=<path>
- if ( defined $debug ) { print(STDERR "WinFormat:\ninclude path:\n$variable\n");};
- $d1_prefix = $1;
- $d1 = $2;
+
+ # Include paths or parameters with filenames
+ if ( $variable =~ /\A(-\w)[\'\"]?((?:\/[\w\.\- ~]+)+\/?)[\'\"]?\Z/ ) {
+ # This regex evaluates -X<path>, sometimes with quotes or "/" at the end
+ # option -> $1, filename without quotes -> $2
+ if ( defined $debug ) { print(STDERR "WinFormat:\ninclude (-X<path>) path:\n$variable\n"); }
+ $d1_prefix = $1;
+ $d1 = $2;
+ } elsif ( $variable =~ /\A(-?\w[\w\.]*=)[\'\"]?((?:\/[\w\.\- ~]+)+\/?)[\'\"]?\Z/ ) {
+ # This regex evaluates [-]X<something>=<path>, sometimes with quotes or "/" at the end
+ # option -> $1, filename without quotes -> $2
+ if ( defined $debug ) { print(STDERR "WinFormat:\ninclude ([-]<something>=<path>) path:\n$variable\n"); }
+ $d1_prefix = $1;
+ $d1 = $2;
+ } else {
+ $d1 = "";
+ }
+ if ( $d1 ne "" ) {
# Some programs (e.g. rsc have problems with filenames with spaces), use short dos paths
if ( $d1 =~ / / ) {
chomp( $d1 = qx{cygpath -d "$d1"} );
@@ -131,10 +144,18 @@ sub WinFormat {
}
$variable = $d1_prefix.$d1;
}
+
+ # Sanity check for -X<path>
if ( $variable =~ /-\w[\'\"]?(?:(?:\/[\w\.\- ~]+)+)/ ) {
print(STDERR "Error: guw.pl: WinFormat: Not converted -X/... type switch in :$variable:.\n");
if ( (defined $debug_light) or (defined $debug) ) { die "\nNot processed -X/...\n"; }
}
+ # Sanity check for [-]X<something>=<path> case
+ if ( $variable =~ /-?\w[\w\.]*=[\'\"]?(?:\/[\w\.\- ~]+)+/ ) {
+ print(STDERR "Error: guw.pl: WinFormat: Not converted [-]X<something>=<path> type switch in :$variable:.\n");
+ if ( (defined $debug_light) or (defined $debug) ) { die "\nNot processed [-]X<something>=/...\n"; }
+ }
+
$variable =~ s/\//\\/g; # Remaining \ come from e.g.: ../foo/baa
$variable =~ s/^\\$/\//g; # a single "/" needs to be preserved