in reply to Any way to simulate a Windows path handling for File::Spec without Windows?
Your code does not work on Windows because you are misusing File::Spec. File::Spec->splitpath returns three items, not two. On *nix, the filename can end up with the directory in the middle, which is why your code appears to work in that case. Read the File::Spec documentation very carefully, and I think you will be able to fix this easily.
Also, you are splitting the directory component, but then using catfile instead of catdir to reassemble those names. Think very carefully about types and what your strings mean, and I think that you will find a solution.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Any way to simulate a Windows path handling for File::Spec without Windows?
by nysus (Parson) on Sep 08, 2019 at 05:53 UTC | |
by jcb (Parson) on Sep 08, 2019 at 05:59 UTC | |
by nysus (Parson) on Sep 08, 2019 at 06:06 UTC | |
by jcb (Parson) on Sep 08, 2019 at 06:16 UTC | |
by nysus (Parson) on Sep 08, 2019 at 06:28 UTC |