From 1fc49f343d3a315e5637afb0531245df26e410e7 Mon Sep 17 00:00:00 2001 From: sergiotarxz Date: Mon, 24 Jun 2024 20:09:12 +0200 Subject: [PATCH] Revert "Removing xdg-config." This reverts commit 7f2f8c41f8b50f4caf0645000bce7084892e0807. --- lib/JapaChar/DB.pm | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/JapaChar/DB.pm b/lib/JapaChar/DB.pm index 491c9cd..c4707ee 100644 --- a/lib/JapaChar/DB.pm +++ b/lib/JapaChar/DB.pm @@ -38,8 +38,15 @@ sub connect { sub _db_path($class) { my $home = $ENV{HOME}; + my $flatpak_config_dir = $ENV{XDG_CONFIG_HOME}; my $db_path = ''; - $db_path = $home . '/' if $home; + { + if ($flatpak_config_dir) { + $db_path = $flatpak_config_dir . '/'; + next; + } + $db_path = $home . '/' if $home; + } $db_path .= '.japachar/db.sqlite'; path($db_path)->parent->mkpath; return $db_path;