Avoid dereferencing $ENV{HOME} if it is undefined

This commit is contained in:
Will Aoki 2019-04-03 09:48:15 -06:00
parent 74defd4812
commit b42cb89fdd

View file

@ -598,7 +598,11 @@ sub check_packages {
#=============================================================================
sub get_config_file_options {
my @defaults = ();
for my $file ("$ENV{HOME}/.stowrc", '.stowrc') {
my @dirlist = ('.stowrc');
if (defined($ENV{HOME})) {
unshift(@dirlist, "$ENV{HOME}/.stowrc");
}
for my $file (@dirlist) {
if (-r $file) {
warn "Loading defaults from $file\n";
open my $FILE, '<', $file