Re: Function to parse filespec
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: Function to parse filespec
- From: Klaus Ripke <paul-lua@...>
- Date: 2009年5月27日 13:12:41 +0200
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