forked from lix-project/lix
Give a better error message if writeFile fails due to permission issues
This commit is contained in:
parent
e775d4d84f
commit
9c29a2ed35
|
@ -23,7 +23,7 @@ sub uniq {
|
||||||
|
|
||||||
sub writeFile {
|
sub writeFile {
|
||||||
my ($fn, $s) = @_;
|
my ($fn, $s) = @_;
|
||||||
open TMP, ">$fn" or die;
|
open TMP, ">$fn" or die "cannot create file `$fn': $!";
|
||||||
print TMP "$s" or die;
|
print TMP "$s" or die;
|
||||||
close TMP or die;
|
close TMP or die;
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@ sub writeFile {
|
||||||
sub readFile {
|
sub readFile {
|
||||||
local $/ = undef;
|
local $/ = undef;
|
||||||
my ($fn) = @_;
|
my ($fn) = @_;
|
||||||
open TMP, "<$fn" or die;
|
open TMP, "<$fn" or die "cannot open file `$fn': $!";
|
||||||
my $s = <TMP>;
|
my $s = <TMP>;
|
||||||
close TMP or die;
|
close TMP or die;
|
||||||
return $s;
|
return $s;
|
||||||
|
|
Loading…
Reference in a new issue