reason other than ENOENT. For ENOENT, we'll go ahead and create it.
my $folders = shift;
my ($fh, $fn);
- if (not open($fh, "$mh/.folders")) {
+ if (open($fh, "$mh/.folders")) {
+ while (<$fh>) {
+ chomp;
+ $folders->{$_}++;
+ }
+ } elsif (not $!{ENOENT}) {
+ # For ENOENT, we go ahead and create it, else we error and
+ # don't clobber it.
warn("open($mh/.folders): $!");
return;
}
- while (<$fh>) {
- chomp;
- $folders->{$_}++;
- }
-
eval { ($fh, $fn) = tempfile("$mh/.folders.XXXXX") };
if ($@) {
warn("$@");