| View previous topic :: View next topic |
| Author |
Message |
moonlight
Joined: 26 Oct 2005 Posts: 567
|
Posted: Mon Apr 03, 2006 9:02 am Post subject: BUG: incorrect way of detecting if a file is a directory |
|
|
There is a bug in luasystem.cpp, in the function lua_dir(lua_State *L).
The following code is NOT the correct way of checking if a file is a directory:
lua_pushboolean(L, g_dir.d_stat.st_attr & FIO_SO_IFDIR);
Even if that works with memory sticks and flash devices, it fails with umd's.
The correct way to check if a file is adirectory is:
lua_pushboolean(L, FIO_S_ISDIR(g_dir.d_stat.st_mode));
(this is the bug that causes LuaFileManager to list umd directories as files, i hope this helps to solve that bug) |
|
| Back to top |
|
 |
glynnder
Joined: 04 Sep 2005 Posts: 35
|
Posted: Mon Apr 03, 2006 10:09 pm Post subject: |
|
|
Ahhhh, that doesn't work on flash0 or flash1 either!
I hope either a) Shine or b) any other decent coder can change that.
Then maybe lua fm will work even better! |
|
| Back to top |
|
 |
moonlight
Joined: 26 Oct 2005 Posts: 567
|
Posted: Mon Apr 03, 2006 10:34 pm Post subject: |
|
|
Here i leave a precompiled binary of LuaPlayer-0.17dk2 with that bug solved.
http://rapidshare.de/files/17099461/EBOOT.PBP.html
To make Lua FileManager work properly with umd's, simply replace the EBOOT.PBP with that one. |
|
| Back to top |
|
 |
Shine
Joined: 03 Dec 2004 Posts: 728 Location: Germany
|
Posted: Mon Apr 03, 2006 10:52 pm Post subject: Re: BUG: incorrect way of detecting if a file is a directory |
|
|
| moonlight wrote: | The correct way to check if a file is adirectory is:
lua_pushboolean(L, FIO_S_ISDIR(g_dir.d_stat.st_mode));
|
Thanks, I've fixed this, will be in the next version. |
|
| Back to top |
|
 |
mallchin
Joined: 16 Feb 2006 Posts: 36
|
Posted: Tue Apr 04, 2006 2:15 am Post subject: |
|
|
Great, thanks.
I'll include this in the next release unless Shine updates LuaPlayer upstream. |
|
| Back to top |
|
 |
|