Created
November 9, 2014 03:30
-
-
Save dagolden/72e21770f41afb438938 to your computer and use it in GitHub Desktop.
path_looks_legal
This file contains hidden or 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
sub path_looks_legal { | |
my ($path) = @_; | |
my @native = File::Spec->splitpath($path); | |
my @unix = File::Spec::Unix->splitpath($path); | |
return if sum( map { $native[$_] ne $unix[$_] ? 1 : 0 } 0 .. 2 ); | |
@native = File::Spec->splitdir($native[1]); | |
@unix = File::Spec::Unix->splitdir($unix[1]); | |
return if sum( map { $native[$_] ne $unix[$_] ? 1 : 0 } 0 .. 2 ); | |
return 1; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment