[Libguestfs] [PATCH 3/3 version 2] Modify Sys::Guestfs::Lib::resolve_windows_path to use case_sensitive_path
Richard W.M. Jones
rjones at redhat.com
Mon Oct 26 09:28:36 UTC 2009
Umm ... they're not quite the same because the error case is
different. Try this updated patch.
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-p2v converts physical machines to virtual machines. Boot with a
live CD or over the network (PXE) and turn machines into Xen guests.
http://et.redhat.com/~rjones/virt-p2v
-------------- next part --------------
>From b3477194e0b7d3e6401addeea2ad4f874a885108 Mon Sep 17 00:00:00 2001
From: Richard Jones <rjones at redhat.com>
Date: Mon, 26 Oct 2009 09:12:12 +0000
Subject: [PATCH 3/3] Modify Sys::Guestfs::Lib::resolve_windows_path to use case_sensitive_path.
---
perl/lib/Sys/Guestfs/Lib.pm | 32 +++-----------------------------
1 files changed, 3 insertions(+), 29 deletions(-)
diff --git a/perl/lib/Sys/Guestfs/Lib.pm b/perl/lib/Sys/Guestfs/Lib.pm
index 8ea2c1b..549916f 100644
--- a/perl/lib/Sys/Guestfs/Lib.pm
+++ b/perl/lib/Sys/Guestfs/Lib.pm
@@ -267,38 +267,12 @@ by C</> characters. Do not use C<\>, drive names, etc.
sub resolve_windows_path
{
- local $_;
my $g = shift;
my $path = shift;
- if (substr ($path, 0, 1) ne "/") {
- warn __"resolve_windows_path: path must start with a / character";
- return undef;
- }
-
- my @elems = split (/\//, $path);
- shift @elems;
-
- # Start reconstructing the path at the top.
- $path = "/";
-
- foreach my $dir (@elems) {
- my $found = 0;
- foreach ($g->ls ($path)) {
- if (lc ($_) eq lc ($dir)) {
- if ($path eq "/") {
- $path = "/$_";
- $found = 1;
- } else {
- $path = "$path/$_";
- $found = 1;
- }
- }
- }
- return undef unless $found;
- }
-
- return $path;
+ my $r;
+ eval { $r = $g->case_sensitive_path ($path); };
+ return $r;
}
=head2 file_architecture
--
1.6.5.rc2
More information about the Libguestfs
mailing list