Программируем под IOS
-
Anonymous
Как существует каталог проверки?
Сообщение
Anonymous »
У меня есть функции для создания каталогов:
Код: Выделить всё
func createSystemFolders(){
// Create a FileManager instance
let fileManager = FileManager.default
do {
try fileManager.createDirectory(atPath: "json", withIntermediateDirectories: true, attributes: nil)
}
catch let error as NSError {
debugPrint("\(ErrorsLabels.AppDelegate01): \(error)")
}
do {
try fileManager.createDirectory(atPath: "inspirations", withIntermediateDirectories: true, attributes: nil)
}
catch let error as NSError {
debugPrint("\(ErrorsLabels.AppDelegate02): \(error)")
}
do {
try fileManager.createDirectory(atPath: "products", withIntermediateDirectories: true, attributes: nil)
}
catch let error as NSError {
debugPrint("\(ErrorsLabels.AppDelegate03): \(error)")
}
}
Мне нужна вторая функция для проверки существования каталога.
Как я могу это проверить?
Подробнее здесь:
https://stackoverflow.com/questions/504 ... tory-exist
1715058540
Anonymous
У меня есть функции для создания каталогов:
[code]func createSystemFolders(){
// Create a FileManager instance
let fileManager = FileManager.default
do {
try fileManager.createDirectory(atPath: "json", withIntermediateDirectories: true, attributes: nil)
}
catch let error as NSError {
debugPrint("\(ErrorsLabels.AppDelegate01): \(error)")
}
do {
try fileManager.createDirectory(atPath: "inspirations", withIntermediateDirectories: true, attributes: nil)
}
catch let error as NSError {
debugPrint("\(ErrorsLabels.AppDelegate02): \(error)")
}
do {
try fileManager.createDirectory(atPath: "products", withIntermediateDirectories: true, attributes: nil)
}
catch let error as NSError {
debugPrint("\(ErrorsLabels.AppDelegate03): \(error)")
}
}
[/code]
Мне нужна вторая функция для проверки существования каталога.
Как я могу это проверить?
Подробнее здесь: [url]https://stackoverflow.com/questions/50405920/how-check-directory-exist[/url]