X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~yarrgweb/git?p=ypp-sc-tools.main.git;a=blobdiff_plain;f=yarrg%2FCommodsWeb.pm;h=0f3f43df8fd236975a57ef5310cccdbf4f14b25f;hp=00c6f24b8cc5ce0ce9713592de4897428ffcdcd6;hb=d892748541adab0a53bbd641a1440f4c65c9cb63;hpb=30375dc1932be83a48fca8122e81b845c4b0ecc2 diff --git a/yarrg/CommodsWeb.pm b/yarrg/CommodsWeb.pm index 00c6f24..0f3f43d 100644 --- a/yarrg/CommodsWeb.pm +++ b/yarrg/CommodsWeb.pm @@ -50,7 +50,7 @@ BEGIN { @ISA = qw(Exporter); @EXPORT = qw(&dbw_connect &dbw_filename &ocean_list &sourcebasedir &to_json_shim &to_json_protecttags - &set_ctype_utf8 + &set_ctype_utf8 &webdatadir &expected_error &dbw_lookup_string &prettyprint_age &meta_prettyprint_age); %EXPORT_TAGS = ( ); @@ -73,20 +73,25 @@ sub sourcebasedir () { return dotperllibdir().'/..'; } -sub datadir () { - my $edir= $ENV{'YARRG_DATA_DIR'}; +sub some_datadir ($) { + my ($what) = @_; + my $edir= $ENV{"YARRG_${what}_DIR"}; return $edir if defined $edir; my $dir= dotperllibdir(); - if (stat "$dir/DATA") { - return "$dir/DATA"; + my $dirwhat= "$dir/$what"; + if (stat $dirwhat) { + return $dirwhat; } elsif ($!==&ENOENT) { return "$dir"; } else { - die "stat $dir/DATA $!"; + die "stat $dirwhat $!"; } return '.'; } +sub webdatadir () { return some_datadir('WEBDATA'); } +sub datadir () { return some_datadir('DATA'); } + my @ocean_list; sub ocean_list () {