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 

sceIoRmdir can't remove a directory which is not empty?

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



Joined: 05 Feb 2006
Posts: 13

PostPosted: Wed May 10, 2006 5:04 pm    Post subject: sceIoRmdir can't remove a directory which is not empty? Reply with quote

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



Joined: 23 Jun 2004
Posts: 313

PostPosted: Thu May 11, 2006 1:17 am    Post subject: Reply with quote

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



Joined: 05 Feb 2006
Posts: 13

PostPosted: Fri May 12, 2006 4:58 pm    Post subject: Reply with quote

thx very much.
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 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