Thursday, December 5, 2013

Xiasha box on iphone application directory delete folders

NSString * documentDir = [NSSearchPathForDirectoriesInDomains (NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex: 0];
documentDir = [documentDir stringByAppendingPathComponent: @ "/ ThemeList"];
BOOL s = [[NSFileManager defaultManager] removeItemAtPath: documentDir error: nil];

This is a deletion of my code. . Delete an application directory box xiasha a ThemeList their new folder.

I now have a problem. .
That is. If I was in this folder and then create a new folder below A. Implementation of the above code. Is OK.
ThemeList folder is deleted. A is also deleted.
If I variable documentDir = [documentDir stringByAppendingPathComponent: @ "/ ThemeList / A"];
You can also delete this folder A single off of. . .


The problem arises. .

A Here again if I create a folder B.
Then delete the code will fail.
And no matter what I put into A good directory. B worth mentioning. Is a failure. . . Deleted directly from ThemeList also failed. .


Solving! ~

Reply:
Detect whether there are documents in the B pointer. Delete to delete the folder inside the file is first, to avoid dangling pointers agreement.
Reply:
I confirm that the B folder nothing. A is how come. B also how to. This is a bug I feel is the directory can only have two layers. A third layer of this problem occurs when three or more
Reply:
The reply was deleted at 2012-09-22 10:31:24 moderator

No comments:

Post a Comment