summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/MDV/Distribconf.pm8
-rw-r--r--t/01distribconf.t17
2 files changed, 20 insertions, 5 deletions
diff --git a/lib/MDV/Distribconf.pm b/lib/MDV/Distribconf.pm
index 4829e89..d8be727 100644
--- a/lib/MDV/Distribconf.pm
+++ b/lib/MDV/Distribconf.pm
@@ -516,7 +516,6 @@ to the media for files having doble location (index for example).
=cut
-
sub getmediapath {
my ($distrib, $media, $var) = @_;
my %files = (
@@ -572,10 +571,11 @@ sub getdpath {
my ($distrib, $media, $var) = @_;
if ($var =~ /^(hdlist|synthesis|pubkey|MD5SUM)$/) {
- if ($distrib->{type} eq 'mandriva') {
- return $distrib->getmediapath($media, $var);
- } else {
+ if ($distrib->getvalue($media, 'cdmode')
+ || $distrib->{type} eq 'mandrake') {
return $distrib->getpath($media, $var);
+ } else {
+ return $distrib->getmediapath($media, $var);
}
} else {
return $distrib->getpath($media, $var);
diff --git a/t/01distribconf.t b/t/01distribconf.t
index f73a154..94beb60 100644
--- a/t/01distribconf.t
+++ b/t/01distribconf.t
@@ -12,7 +12,7 @@ my %testdpath = (
'http://server/path/' => 'testdata/test/media/media_info/media.cfg',
);
-plan tests => 14 + 29 * scalar(keys %testdpath);
+plan tests => 16 + 29 * scalar(keys %testdpath);
use_ok('MDV::Distribconf');
@@ -115,3 +115,18 @@ like($dconf->getpath(undef, 'media_info'), qr!^/*infodir/?$!, "Can get media_inf
'getvalue works'
);
}
+
+{
+ my $dc = MDV::Distribconf->new('testdata/test3');
+ $dc->load();
+ is( $dc->getdpath('main', 'hdlist'),
+ $dc->getmediapath('main', 'hdlist'),
+ "Can get default path w/o cdmode"
+ );
+ $dc->{cfg}->newval('media_info', 'cdmode', 1);
+ is( $dc->getdpath('main', 'hdlist'),
+ $dc->getpath('main', 'hdlist'),
+ "Can get default path w/ cdmode"
+ );
+}
+