Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add Epoc, tests and all (it was only two functions *shrug*)
- Loading branch information
Showing
1 changed file
with
26 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,29 @@ | ||
class File::Spec::Epoc; | ||
use v6; | ||
use File::Spec::Unix; | ||
class File::Spec::Epoc is File::Spec::Unix; | ||
|
||
my $module = "File::Spec::Unix"; | ||
require $module; | ||
|
||
method canonpath { ::($module).canonpath() } | ||
method catdir { ::($module).catdir() } | ||
method catfile { ::($module).catfile() } | ||
method curdir { ::($module).curdir() } | ||
method devnull { ::($module).devnull() } | ||
method rootdir { ::($module).rootdir() } | ||
method tmpdir { ::($module).tmpdir() } | ||
method updir { ::($module).updir() } | ||
method no_upwards { ::($module).no_upwards() } | ||
method case_tolerant { 1 } | ||
method file_name_is_absolute { ::($module).file_name_is_absolute() } | ||
method path { ::($module).path() } | ||
method join { ::($module).join() } | ||
method splitpath { ::($module).splitpath() } | ||
method splitdir { ::($module).splitdir() } | ||
method catpath { ::($module).catpath() } | ||
method abs2rel { ::($module).abs2rel() } | ||
method rel2abs { ::($module).rel2abs() } | ||
|
||
method default_case_tolerant { True } | ||
method case_tolerant { True } | ||
|
||
method canonpath ($path is copy) { | ||
return unless defined $path; | ||
|
||
$path ~~ s:g❙ '/'+ ❙/❙; # xx////xx -> xx/xx | ||
$path ~~ s:g❙ '/.'+ '/' ❙/❙; #: xx/././xx -> xx/xx | ||
$path ~~ s❙^ './'+❙❙ unless $path eq "./"; # ./xx -> xx | ||
$path ~~ s❙^ '/' '../'+ ❙/❙; # /../../xx -> xx | ||
$path ~~ s❙ '/' $❙❙ unless $path eq "/"; # xx/ -> xx | ||
return $path; | ||
} | ||
|
||
|
||
=begin pod | ||
This is a Perl6 port of all Perl 5's File::Spec has for Epoc. | ||
Dead OS is dead. ⛼ | ||
See File::Spec::Win32 for Symbian support. | ||
=end pod |