lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Related:

I've recently ran into some issues with pl.path:
 - new path.normpath: I believe the current implementation does not
handle more than one (consecutive) ".." properly.
 - I also wanted to have '/' as dir separator on a windows OS (for
aesthetic reasons), but that wasn't as simple as expected.

Attached is a changed pl.path:
- "the normalizing multiple .."- issue is fixed.
- I made it so you can pick your preferred separator on windows via
path.prefer_slash, which is simply ignored if not path.is_windows
(path.prefer_slash is meant to be changed by the user after loading
the module and basically just affects how paths are normpath'ed).
- If path.is_windows: Unicode paths are considered absolute and left
alone (e.g. [[\\.\COM56]]).
- path.sep was removed.

I believe all of those changes to be an improvement; IMHO there was
not much point in setting path.sep to sth. exotic anyway (like '.')
since that silently broke path.normpath and all other functions using
string patterns which embedded '\' or '/'.

This was not extensively tested, but I believe it doesn't break
anything that worked before.

All changes I made are to be considered public domain, etc...

Wolfgang Pupp

Attachment: path.lua
Description: Binary data