From 185fe331a61b455853586eb3338029bee95e6aa8 Mon Sep 17 00:00:00 2001 From: Sergiotarxz Date: Mon, 4 Mar 2024 03:25:53 +0100 Subject: [PATCH] Changing the search for home because strawberry perl is broken. --- Build.PL | 1 - lib/GEmeTool/Config.pm | 16 +++++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/Build.PL b/Build.PL index 075a2d5..f5cea5b 100755 --- a/Build.PL +++ b/Build.PL @@ -14,7 +14,6 @@ my $build = Module::Build->new( 'Path::Tiny' => 0, 'DBD::SQLite' => 0, 'DBI' => 0, - 'File::HomeDir' => 0, 'Moo' => 0, 'namespace::clean' => 0, 'UUID::URandom' => 0, diff --git a/lib/GEmeTool/Config.pm b/lib/GEmeTool/Config.pm index 5450a9d..f2346de 100644 --- a/lib/GEmeTool/Config.pm +++ b/lib/GEmeTool/Config.pm @@ -6,21 +6,31 @@ use strict; use warnings; use Moo; -use File::HomeDir; use Path::Tiny; my $dist = 'GEmeTool'; sub config_dir { my $class = shift; - my $config_dir = path(File::HomeDir->my_home)->child('.gemetool/config'); + my $config_dir = path($class->find_home)->child('.gemetool/config'); $config_dir->mkpath; return $config_dir; } + sub data_dir { my $class = shift; - my $data_dir = path(File::HomeDir->my_home)->child('.gemetool/data'); + my $data_dir = path($class->find_home)->child('.gemetool/data'); $data_dir->mkpath; return $data_dir; } + +sub find_home { + if (defined $ENV{HOME}) { + return $ENV{HOME}; + } + if (defined $ENV{USERPROFILE}) { + return $ENV{USERPROFILE}; + } + return path('.')->absolute; +} 1;