O arquivo realmExists sempre é verdadeiro
Quero copiar o arquivo de região pré-carregado, então faço:
Copiei meu arquivo para o navegador do projeto chamadodefault.realm
. Então verifique sefileExists:
:
let bundlePath = Bundle.main.path(forResource: "default", ofType: "realm")
let destPath = Realm.Configuration.defaultConfiguration.fileURL?.path
let fileManager = FileManager.default
if fileManager.fileExists(atPath: destPath!) {
//File exist, do nothing
print("File exist")
} else {
do {
//Copy file from bundle to Realm default path
try fileManager.copyItem(atPath: bundlePath!, toPath: destPath!)
print("Copied")
} catch {
print("\n",error)
}
}
E sempre retorna true, então não consigo copiar meu arquivo de região.