What's a quick way to test to see a file exists?

后端 未结 1 1358
旧时难觅i
旧时难觅i 2020-12-12 16:52

I want to quickly check to see if a file exists in my iPhone app\'s Documents directory (or any path for that matter). I can enumerate through the directory\'s files, or I

相关标签:
1条回答
  • 2020-12-12 17:30

    Swift v3:

    let fileExists = FileManager.default.fileExists(atPath: somePath)

    Thanks to Nikolay Suvandzhiev.

    Objective-C (Original):

    BOOL fileExists = [[NSFileManager defaultManager] fileExistsAtPath:somePath];

    0 讨论(0)
提交回复
热议问题