Re: File System Library

[email protected] Wed, 11 Aug 2004 20:40:21 +0200
Newsgroups gmane.comp.lang.lua.luacheia
Message-ID <[email protected]>
On Wed, 11 Aug 2004 12:03:37 -0400, "Thatcher Ulrich" <[email protected]>
said:
> On Aug 11, 2004 at 11:23 -0300, Tomas wrote:
> > 
> > 	As I told Martin, we think it would be better to join the
> > efforts and maybe merge the two libraries into a single one that could
> > serve both projects.  

I think it's a good idea. There's no real sense in maintaining two
different modules when the purpose of both is the same.

I vote for the iterator approach to directory traversing, because
it's lightweight (i.e: no need to create a big table with a lot of
strings, only a string at a time is generated) and if the iterator
is well written it could be used with Lua's generic 'for'. Something
like:

  for filename in fs.listdir('/some/path/') do
    -- do something with each filename
  end
 
> [...] Also we don't have lock/unlock, so that's useful.  [...]

I agree.

> 
> > 	Another doubt I have is if it is better to improve lposix to
> > work on Windows.  What do you think?
>
> My inclination would be to leave the lposix question up to LHF, unless
> there's strong user demand for a Windows version.
>

I think we could do something like the 'sys' module in Python: on 
Unix-like systems it uses the 'posix' module as backend, but when
running in Win32, it uses a windows-only module as backend. This 
approach is extensible, and some other backends could be added for
"exotic" operating systems with "funny" filepaths (I', thinking 
about VMS or RiscOS, for example :P)

--
Adrian Perez
moebius _at_ eml.cc


-------------------------------------------------------
SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media
100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285