Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Add IO::Spec::QNX to make Unix more efficient
QNX and Neutrino(nto) use //path special syntax, but there's no need to penalize every other unix with extra operations in canonpath. Plus it was never tested on qnx so it didn't even work... now fixed Seriously, what bozo implemented this in the first place?
- Loading branch information
Showing
4 changed files
with
25 additions
and
16 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
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 |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| my class IO::Spec::QNX is IO::Spec::Unix { | ||
|
|
||
| method canonpath ($path is copy, :$parent) { | ||
| # Handle POSIX-style node names beginning with double slash (qnx, nto) | ||
| # (POSIX says: "a pathname that begins with two successive slashes | ||
| # may be interpreted in an implementation-defined manner, although | ||
| # more than two leading slashes shall be treated as a single slash.") | ||
| my $node = ''; | ||
| if $path ~~ s {^ ( '//' <-[ / ]>+ ) '/'? $} = '' | ||
| or $path ~~ s {^ ( '//' <-[ / ]>+ ) '/' } = '/' | ||
| { $node = ~ $0; } | ||
|
|
||
| $path = IO::Spec::Unix.canonpath($path, :$parent); | ||
|
|
||
| $node ~ $path; | ||
| } | ||
| } |
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
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