ensure cache folder when requiring dirs file

This commit is contained in:
Jorge Morante 2023-05-12 15:26:39 +02:00
parent 0000dd1bf7
commit 417be1c910
3 changed files with 4 additions and 5 deletions

View File

@ -44,7 +44,6 @@ class Fingers::Commands::LoadConfig < Fingers::Commands::Base
}
def run
ensure_cache_folder
validate_options!
parse_tmux_conf
setup_bindings
@ -162,10 +161,6 @@ class Fingers::Commands::LoadConfig < Fingers::Commands::Base
true
end
def ensure_cache_folder
FileUtils.mkdir_p(Fingers::Dirs::CACHE) unless File.exists?(Fingers::Dirs::CACHE)
end
def fingers_options_names
@fingers_options_names ||= `tmux show-options -g | grep ^@fingers`.chomp.split("\n").map { |line| line.split(" ")[0] }
end

View File

@ -9,4 +9,7 @@ module Fingers::Dirs
CACHE = ROOT / "tmux-fingers"
CONFIG_PATH = CACHE / "config.json"
SOCKET_PATH = CACHE / "fingers.sock"
# ensure cache folder
FileUtils.mkdir_p(Fingers::Dirs::CACHE) unless File.exists?(Fingers::Dirs::CACHE)
end

View File

@ -1,4 +1,5 @@
require "log"
require "../fingers/dirs"
module Fingers
Log.setup(:debug, Log::IOBackend.new(File.new(Dirs::LOG_PATH, "a+")))