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 

Now I have a weird fioRemove issue

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PS2 Development
View previous topic :: View next topic  
Author Message
KaylaKaze



Joined: 05 May 2004
Posts: 75
Location: NC, USA

PostPosted: Wed Nov 10, 2004 4:02 am    Post subject: Now I have a weird fioRemove issue Reply with quote

Okay, here's my recursive delete function
Code:
int fioRecursiveDelete(u8* folder)
{
   int ret;
   fio_dirent_t dirbuf;
   u8 path[1025];
   int fd, rv;
   printf("fioRecursiveDelete %s\n", folder);
   if ((fd= fioDopen(folder)) < 0) return fd;
   while((rv=fioDread(fd, &dirbuf)))
      {
         strcpy(path,folder);
         strcat(path,"/");
         strcat(path,(char *)&dirbuf.name);
         printf("File: %s Attr:%04x\n", path, dirbuf.stat.mode);
         if(dirbuf.stat.mode & FIO_SO_IFREG) {printf("Deleteing %s\n", path);ret = fioRemove(path);}
         else if((dirbuf.stat.mode & FIO_SO_IFDIR) && (strncmp((char *)&dirbuf.name,".",1)))
         {
            if ((ret = fioRecursiveDelete(path) < 0)) goto error1;
            if ((ret = FileRmdir(path)) < 0) goto error1;
            }
         }
      ret = 0;
error1:
      fioDclose(fd);
      FileRmdir(folder);
   return ret;
}



And here's some sample output:
Code:

fioRecursiveDelete mc0:/BASLUS-20827MANHUNT
dopen name mc0:/BASLUS-20827MANHUNT
dopen fd = 2
File: mc0:/BASLUS-20827MANHUNT/. Attr:0027
File: mc0:/BASLUS-20827MANHUNT/.. Attr:0027
File: mc0:/BASLUS-20827MANHUNT/icon.sys Attr:0017
Deleteing mc0:/BASLUS-20827MANHUNT/icon.sys
remove file mc0:/BASLUS-20827MANHUNT/icon.sys
mkdir name mc0:/BASLUS-20827MANHUNT/icon.sys
File: mc0:/BASLUS-20827MANHUNT/PS2VIEW.ICO Attr:0017
Deleteing mc0:/BASLUS-20827MANHUNT/PS2VIEW.ICO
remove file mc0:/BASLUS-20827MANHUNT/PS2VIEW.ICO
mkdir name mc0:/BASLUS-20827MANHUNT/PS2VIEW.ICO
File: mc0:/BASLUS-20827MANHUNT/BASLUS-20827MANHUNT Attr:0017
Deleteing mc0:/BASLUS-20827MANHUNT/BASLUS-20827MANHUNT
remove file mc0:/BASLUS-20827MANHUNT/BASLUS-20827MANHUNT
File: mc0:/BASLUS-20827MANHUNT/MANHUNT0.SAV Attr:0017
Deleteing mc0:/BASLUS-20827MANHUNT/MANHUNT0.SAV
remove file mc0:/BASLUS-20827MANHUNT/MANHUNT0.SAV
mkdir name mc0:/BASLUS-20827MANHUNT/MANHUNT0.SAV
rmdir name mc0:/BASLUS-20827MANHUNT


So... why is this thing making directories of the same name as the files it's deleting?

Once I get this basic stuff done, it shouldn't be long before I can release the program. And, once I finish this thing, I can start work on a PS2 HD based game.
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Drakonite
Site Admin


Joined: 17 Jan 2004
Posts: 989

PostPosted: Wed Nov 10, 2004 7:00 am    Post subject: Reply with quote

I seem to remember this being a bug in the rom mc drivers. Something along the lines of switch statement that handles what command is being done missing a break at the end of delete, which causes it to go on to mkdir...

Don't quote me on this but I seem to remember this was the case.
_________________
Shoot Pixels Not People!
Makeshift Development
Back to top
View user's profile Send private message Visit poster's website
KaylaKaze



Joined: 05 May 2004
Posts: 75
Location: NC, USA

PostPosted: Wed Nov 10, 2004 11:30 pm    Post subject: Reply with quote

Well, I added an Rmdir(path) command after the Remove(path) so it's at least coming out the way it should.
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Herben



Joined: 25 Jan 2004
Posts: 107

PostPosted: Thu Nov 11, 2004 5:21 am    Post subject: Reply with quote

it's a bug in the ROM FILEIO/XFILEIO drivers. the writer of the modules forgot a "break;" at the end of the case for fioRemove in the RPC server switch, so it continues on to the next case, which happens to be mkdir. So your solution of following any removes with a rmdir is the best thing to do to resolve it.
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 -> PS2 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