]> Sergey Matveev's repositories - public-inbox.git/commitdiff
lei: expose share_path as a method
authorEric Wong <e@80x24.org>
Fri, 16 Apr 2021 23:10:28 +0000 (16:10 -0700)
committerEric Wong <e@80x24.org>
Sat, 17 Apr 2021 02:24:47 +0000 (22:24 -0400)
Since saved-searches aren't a part of lei/store, nor
could it be considered cache data... (or can it? it
is discardable, after all).

lib/PublicInbox/LEI.pm
lib/PublicInbox/LeiSavedSearch.pm

index 4b87c104bec98df6936a4af1dc81d56e57f41ee9..52b588a22a99bf8c94e5b3aa14093f7e84465bba 100644 (file)
@@ -83,13 +83,15 @@ sub rel2abs ($$) {
        File::Spec->rel2abs($p, $pwd);
 }
 
-sub store_path ($) {
+sub share_path ($) { # $HOME/.local/share/lei/$FOO
        my ($self) = @_;
        rel2abs($self, ($self->{env}->{XDG_DATA_HOME} //
                ($self->{env}->{HOME} // '/nonexistent').'/.local/share')
-               .'/lei/store');
+               .'/lei');
 }
 
+sub store_path ($) { share_path($_[0]) . '/store' }
+
 sub _config_path ($) {
        my ($self) = @_;
        rel2abs($self, ($self->{env}->{XDG_CONFIG_HOME} //
index e79cf76a71285531f2663c4e8668918eec55f325..fe8301d6a717a0c14bc8da120c38075df6975ff5 100644 (file)
@@ -23,7 +23,7 @@ sub new {
                        return $lei->fail("$f non-existent or unreadable");
                $self->{-cfg} = PublicInbox::Config::git_config_dump($f);
        } else { # new saved search "lei q --save"
-               my $saved_dir = $lei->store_path . '/../saved-searches/';
+               my $saved_dir = $lei->share_path . '/saved-searches/';
                my (@name) = ($lei->{ovv}->{dst} =~ m{([\w\-\.]+)/*\z});
                my $q = $lei->{mset_opt}->{q_raw} // die 'BUG: {q_raw} missing';
                my $q_raw_str = ref($q) ? "@$q" : $q;