Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

tmpdir for Unix and Mac

  • Loading branch information...
commit 48c93d7b16cd6a7564e7de5a6b54c1c4b883bdee 1 parent 79a3438
@FROGGS authored
Showing with 26 additions and 3 deletions.
  1. +9 −3 lib/File/Spec/Mac.pm
  2. +17 −0 lib/File/Spec/Unix.pm
View
12 lib/File/Spec/Mac.pm
@@ -8,9 +8,15 @@ role File::Spec::OS {
also does File::Spec::Unix;
# and add Mac specific stuff
- #method curdir {
- # '3'
- #}
+ method curdir {
+ ':'
+ }
+
+ my $tmpdir;
+ method tmpdir {
+ return $tmpdir if $tmpdir.defined;
+ $tmpdir = self._tmpdir( %*ENV{'TMPDIR'} );
+ }
}
1;
View
17 lib/File/Spec/Unix.pm
@@ -6,6 +6,23 @@ role File::Spec::Unix {
method curdir {
'.'
}
+
+ my $tmpdir;
+ method _tmpdir( *@dirlist ) {
+ return $tmpdir if $tmpdir.defined;
+ for @dirlist -> $dir {
+ next unless $dir.defined && $dir.IO.d && $dir.IO.w;
+ $tmpdir = $dir;
+ last;
+ }
+ $tmpdir = self.curdir unless $tmpdir.defined;
+ #$tmpdir = $tmpdir.defined && self.canonpath( $tmpdir );
+ return $tmpdir;
+ }
+ method tmpdir {
+ return $tmpdir if $tmpdir.defined;
+ $tmpdir = self._tmpdir( %*ENV{'TMPDIR'}, '/tmp' );
+ }
}
role File::Spec::OS {
Please sign in to comment.
Something went wrong with that request. Please try again.