lua-users home
lua-l archive

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


On Wed, May 27, 2009 at 01:02:32PM +0200, steve donovan wrote:
> Here is a more careful function:
> 
> function split(path)
>    -- do we have an extension? If so, remove it
>     local ie = path:find('%.[^%.]+$') or #path+1
>     local ext = path:sub(ie)
>     path = path:sub(1,ie-1)

wouldn't that fail on /dir.with.dots/file-no-dots ?

I guess slashes should be taken care of first,
after all they do really matter to filesystems,
while extensions are mostly a convention.


cheers
Klaus