[Libguestfs] [PATCH 3/3] Deprecate Sys::Guestfs::Lib::resolve_windows_path.
Richard W.M. Jones
rjones at redhat.com
Mon Oct 26 09:21:08 UTC 2009
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming blog: http://rwmj.wordpress.com
Fedora now supports 80 OCaml packages (the OPEN alternative to F#)
http://cocan.org/getting_started_with_ocaml_on_red_hat_and_fedora
-------------- next part --------------
>From ef9136c7e5e177a266c0738c7003116fb4698d29 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] Deprecate Sys::Guestfs::Lib::resolve_windows_path.
This function can be directly replaced by $g->case_sensitive_path ($path).
---
perl/lib/Sys/Guestfs/Lib.pm | 45 +++++++++---------------------------------
1 files changed, 10 insertions(+), 35 deletions(-)
diff --git a/perl/lib/Sys/Guestfs/Lib.pm b/perl/lib/Sys/Guestfs/Lib.pm
index 8ea2c1b..f7aaf07 100644
--- a/perl/lib/Sys/Guestfs/Lib.pm
+++ b/perl/lib/Sys/Guestfs/Lib.pm
@@ -247,6 +247,9 @@ sub _is_pv {
=head2 resolve_windows_path
+I<This function is deprecated>.
+Use C<$g-E<gt>case_sensitive_path> as a direct substitute.
+
$path = resolve_windows_path ($g, $path);
$path = resolve_windows_path ($g, "/windows/system");
@@ -267,38 +270,10 @@ 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;
+ return $g->case_sensitive_path ($path);
}
=head2 file_architecture
@@ -914,7 +889,7 @@ sub _check_windows_root
my $r = shift;
my $use_windows_registry = shift;
- my $boot_ini = resolve_windows_path ($g, "/boot.ini");
+ my $boot_ini = $g->case_sensitive_path ("/boot.ini");
$r->{boot_ini} = $boot_ini;
if (defined $r->{boot_ini}) {
@@ -935,7 +910,7 @@ sub _check_windows_root
}
if (defined $systemroot) {
- $r->{systemroot} = resolve_windows_path ($g, "/$systemroot");
+ $r->{systemroot} = $g->case_sensitive_path ("/$systemroot");
if (defined $r->{systemroot}) {
_check_windows_arch ($g, $r, $r->{systemroot});
if ($use_windows_registry) {
@@ -956,7 +931,7 @@ sub _check_windows_arch
my $systemroot = shift;
my $cmd_exe =
- resolve_windows_path ($g, $r->{systemroot} . "/system32/cmd.exe");
+ $g->case_sensitive_path ($r->{systemroot} . "/system32/cmd.exe");
$r->{arch} = file_architecture ($g, $cmd_exe) if $cmd_exe;
}
@@ -970,14 +945,14 @@ sub _check_windows_registry
# Download the system registry files. Only download the
# interesting ones, and we don't bother with user profiles at all.
- my $configdir = resolve_windows_path ($g, "$systemroot/system32/config");
+ my $configdir = $g->case_sensitive_path ("$systemroot/system32/config");
if (defined $configdir) {
- my $softwaredir = resolve_windows_path ($g, "$configdir/software");
+ my $softwaredir = $g->case_sensitive_path ("$configdir/software");
if (defined $softwaredir) {
_load_windows_registry ($g, $r, $softwaredir,
"HKEY_LOCAL_MACHINE\\SOFTWARE");
}
- my $systemdir = resolve_windows_path ($g, "$configdir/system");
+ my $systemdir = $g->case_sensitive_path ("$configdir/system");
if (defined $systemdir) {
_load_windows_registry ($g, $r, $systemdir,
"HKEY_LOCAL_MACHINE\\System");
--
1.6.5.rc2
More information about the Libguestfs
mailing list