 |
forums.ps2dev.org Homebrew PS2, PSP & PS3 Development Discussions
|
| View previous topic :: View next topic |
| Author |
Message |
KaylaKaze
Joined: 05 May 2004 Posts: 75 Location: NC, USA
|
Posted: Wed Nov 10, 2004 4:02 am Post subject: Now I have a weird fioRemove issue |
|
|
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 |
|
 |
Drakonite Site Admin

Joined: 17 Jan 2004 Posts: 989
|
Posted: Wed Nov 10, 2004 7:00 am Post subject: |
|
|
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 |
|
 |
KaylaKaze
Joined: 05 May 2004 Posts: 75 Location: NC, USA
|
Posted: Wed Nov 10, 2004 11:30 pm Post subject: |
|
|
| 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 |
|
 |
Herben
Joined: 25 Jan 2004 Posts: 107
|
Posted: Thu Nov 11, 2004 5:21 am Post subject: |
|
|
| 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 |
|
 |
|
|
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
|