From bc7f9e3322a36b7aa42b273fd82d1c1da7b69b00 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 16 Apr 2021 16:10:28 -0700 Subject: lei: expose share_path as a method 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 | 6 ++++-- lib/PublicInbox/LeiSavedSearch.pm | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/PublicInbox/LEI.pm b/lib/PublicInbox/LEI.pm index 4b87c104..52b588a2 100644 --- a/lib/PublicInbox/LEI.pm +++ b/lib/PublicInbox/LEI.pm @@ -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} // diff --git a/lib/PublicInbox/LeiSavedSearch.pm b/lib/PublicInbox/LeiSavedSearch.pm index e79cf76a..fe8301d6 100644 --- a/lib/PublicInbox/LeiSavedSearch.pm +++ b/lib/PublicInbox/LeiSavedSearch.pm @@ -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; -- cgit v1.2.3-24-ge0c7