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

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
rzxiao
Posts: 13
Joined: Sun Feb 05, 2006 7:55 pm

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

Post by rzxiao »

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!
chp
Posts: 313
Joined: Wed Jun 23, 2004 7:16 am

Post by chp »

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: Select all

void recursiveDelete&#40;string dir&#41;
&#123;
 handle h = opendir&#40;dir&#41;;
 while &#40;string entry = readdir&#40;h&#41;&#41;
 &#123;
  string fullname = dir + '/' + entry;

  if &#40;isdir&#40;fullname&#41;&#41;
  &#123;
   recursiveDelete&#40;fullname&#41;;
   rmdir&#40;fullname&#41;;
  &#125;
  else
   unlink&#40;fullname&#41;;
 &#125;
 closedir&#40;h&#41;;
&#125;
GE Dominator
rzxiao
Posts: 13
Joined: Sun Feb 05, 2006 7:55 pm

Post by rzxiao »

thx very much.
Post Reply