PenLight dir.makepath() not working

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

PenLight dir.makepath() not working

RJP Computing
Hi,

I found an issue with pl.dir.makepath() on Windows, Linux and Mac OSX. Here is the error message.

$ lua
Lua 5.1.4  Copyright (C) 1994-2008 Lua.org, PUC-Rio
> require( "pl.dir" )
> pl.dir.makepath( "foo/bar" )
/usr/share/lua/5.1/pl/dir.lua:199: attempt to get length of local 'p' (a nil value)
stack traceback:
/usr/share/lua/5.1/pl/dir.lua:199: in function 'makepath'
/usr/share/lua/5.1/pl/dir.lua:202: in function 'makepath'
/usr/share/lua/5.1/pl/dir.lua:202: in function 'makepath'
stdin:1: in main chunk
[C]: ?

Thoughts?
--
Regards,
Ryan
Reply | Threaded
Open this post in threaded view
|

Re: PenLight dir.makepath() not working

steve donovan
On Thu, Jan 14, 2010 at 7:30 PM, RJP Computing <[hidden email]> wrote:
> Thoughts?

Breaks here as well, we definitely have a bug!

I'll give you a fix tomorrow.

steve d.
Reply | Threaded
Open this post in threaded view
|

Re: PenLight dir.makepath() not working

RJP Computing
On Thu, Jan 14, 2010 at 12:37 PM, steve donovan <[hidden email]> wrote:
On Thu, Jan 14, 2010 at 7:30 PM, RJP Computing <[hidden email]> wrote:
> Thoughts?

Breaks here as well, we definitely have a bug!

I'll give you a fix tomorrow.

Great. I did a bit more investigation and it seems like it has to do with the first directory (foo) not existing. Hope that helps.
--
Regards,
Ryan
Reply | Threaded
Open this post in threaded view
|

Re: PenLight dir.makepath() not working

steve donovan
On Thu, Jan 14, 2010 at 7:41 PM, RJP Computing <[hidden email]> wrote:
> Great. I did a bit more investigation and it seems like it has to do with
> the first directory (foo) not existing. Hope that helps.

Then as Peter Cawley once said:  it does not do what it says on the tin.

(Nice English expression)
Reply | Threaded
Open this post in threaded view
|

Re: PenLight dir.makepath() not working

RJP Computing
Steve,

On Thu, Jan 14, 2010 at 12:44 PM, steve donovan <[hidden email]> wrote:
On Thu, Jan 14, 2010 at 7:41 PM, RJP Computing <[hidden email]> wrote:
> Great. I did a bit more investigation and it seems like it has to do with
> the first directory (foo) not existing. Hope that helps.

Then as Peter Cawley once said:  it does not do what it says on the tin.

(Nice English expression)

Any update on this? Just kind of getting close to needing this functionality.
--
Regards,
Ryan
Reply | Threaded
Open this post in threaded view
|

Re: PenLight dir.makepath() not working

steve donovan
On Mon, Jan 18, 2010 at 6:12 PM, RJP Computing <[hidden email]> wrote:
> Any update on this? Just kind of getting close to needing this
> functionality.

Weirdly broken, this one. This seems to do the job:

function _makepath(p)
   if not path.isdir(p) then
    local subp = p:match(dirpat)
    if not _makepath(subp) then return false end
    return lfs.mkdir(p)
   else
    return true
   end
end

function makepath (p)
    return _makepath(path.normcase(path.abspath(p)))
end

That is, it's necesary to start with the full path, and work with
that. Tested on Windoze, should work on the other side!

steve d.
Reply | Threaded
Open this post in threaded view
|

Re: PenLight dir.makepath() not working

Ryan Pusztai

Do you plan to release Penlight soon?
--
Regards,
Ryan

On Jan 18, 2010 11:47 AM, "steve donovan" <[hidden email]> wrote:

On Mon, Jan 18, 2010 at 6:12 PM, RJP Computing <[hidden email]> wrote: > Any update on this?...

Weirdly broken, this one. This seems to do the job:

function _makepath(p)
  if not path.isdir(p) then
   local subp = p:match(dirpat)
   if not _makepath(subp) then return false end
   return lfs.mkdir(p)
  else
   return true
  end
end

function makepath (p)
   return _makepath(path.normcase(path.abspath(p)))
end

That is, it's necesary to start with the full path, and work with
that. Tested on Windoze, should work on the other side!

steve d.

Reply | Threaded
Open this post in threaded view
|

Re: PenLight dir.makepath() not working

steve donovan
On Sat, Jan 23, 2010 at 6:30 PM, Ryan Pusztai <[hidden email]> wrote:
> Do you plan to release Penlight soon?

Sure, within the next week.

Currently I'm wresting with a reported problem with SciTE in LfW, the
'Launch Interactive Lua' is not behaving.
Reply | Threaded
Open this post in threaded view
|

Re: PenLight dir.makepath() not working

Ryan Pusztai

Ok. Let me know if we need to release LfW.

On Jan 23, 2010 11:36 AM, "steve donovan" <[hidden email]> wrote:

On Sat, Jan 23, 2010 at 6:30 PM, Ryan Pusztai <[hidden email]> wrote: > Do you plan to release P...

Sure, within the next week.

Currently I'm wresting with a reported problem with SciTE in LfW, the
'Launch Interactive Lua' is not behaving.