【发布时间】:2012-02-29 23:01:20
【问题描述】:
我通过按一个按钮在文档目录中创建一个带有字符串@"My Folder" 的目录。 但是如果这个目录已经存在,我希望它被命名为@“My Folder 1”,如果存在,那么@“My Folder 2”等等。 我怎样才能做到这一点?
我用这个测试目录是否已经存在
if (![[NSFileManager defaultManager] fileExistsAtPath:dataPath])
[[NSFileManager defaultManager] createDirectoryAtPath:dataPath withIntermediateDirectories:NO attributes:nil error:nil];
else {
}
【问题讨论】:
标签: iphone cocoa-touch nsstring nsfilemanager