forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

BUG: incorrect way of detecting if a file is a directory

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Lua Player Development
View previous topic :: View next topic  
Author Message
moonlight



Joined: 26 Oct 2005
Posts: 567

PostPosted: Mon Apr 03, 2006 9:02 am    Post subject: BUG: incorrect way of detecting if a file is a directory Reply with quote

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
View user's profile Send private message
glynnder



Joined: 04 Sep 2005
Posts: 35

PostPosted: Mon Apr 03, 2006 10:09 pm    Post subject: Reply with quote

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
View user's profile Send private message
moonlight



Joined: 26 Oct 2005
Posts: 567

PostPosted: Mon Apr 03, 2006 10:34 pm    Post subject: Reply with quote

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
View user's profile Send private message
Shine



Joined: 03 Dec 2004
Posts: 728
Location: Germany

PostPosted: Mon Apr 03, 2006 10:52 pm    Post subject: Re: BUG: incorrect way of detecting if a file is a directory Reply with quote

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
View user's profile Send private message
mallchin



Joined: 16 Feb 2006
Posts: 36

PostPosted: Tue Apr 04, 2006 2:15 am    Post subject: Reply with quote

moonlight wrote:
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.


Great, thanks.

I'll include this in the next release unless Shine updates LuaPlayer upstream.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Lua Player Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group