| View previous topic :: View next topic |
| Author |
Message |
rzxiao
Joined: 05 Feb 2006 Posts: 13
|
Posted: Wed May 10, 2006 5:04 pm Post subject: sceIoRmdir can't remove a directory which is not empty? |
|
|
hi ,I am new here. My question is: Could sceIoRmdir remove a directory whick is not empty. Because it always return <0 when directory is not enpty.
And is there a function to do it ?
Thanks very much! |
|
| Back to top |
|
 |
chp
Joined: 23 Jun 2004 Posts: 313
|
Posted: Thu May 11, 2006 1:17 am Post subject: |
|
|
You would have to delete everything inside that directory to successfully delete the directory. Some simple pseudocode that you could translate into proper code: | Code: | void recursiveDelete(string dir)
{
handle h = opendir(dir);
while (string entry = readdir(h))
{
string fullname = dir + '/' + entry;
if (isdir(fullname))
{
recursiveDelete(fullname);
rmdir(fullname);
}
else
unlink(fullname);
}
closedir(h);
} |
_________________ GE Dominator |
|
| Back to top |
|
 |
rzxiao
Joined: 05 Feb 2006 Posts: 13
|
Posted: Fri May 12, 2006 4:58 pm Post subject: |
|
|
| thx very much. |
|
| Back to top |
|
 |
|