Resolving symlinks in path (#679)
This commit is contained in:
parent
1e79e12593
commit
3292bd3652
1 changed files with 2 additions and 2 deletions
|
|
@ -153,6 +153,7 @@ public final class PasswordEntity: NSManagedObject, Identifiable {
|
||||||
|
|
||||||
public static func initPasswordEntityCoreData(url: URL, in context: NSManagedObjectContext) {
|
public static func initPasswordEntityCoreData(url: URL, in context: NSManagedObjectContext) {
|
||||||
let localFileManager = FileManager.default
|
let localFileManager = FileManager.default
|
||||||
|
let url = url.resolvingSymlinksInPath()
|
||||||
|
|
||||||
let root = {
|
let root = {
|
||||||
let entity = PasswordEntity(context: context)
|
let entity = PasswordEntity(context: context)
|
||||||
|
|
@ -190,8 +191,7 @@ public final class PasswordEntity: NSManagedObject, Identifiable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
passwordEntity.parent = current
|
passwordEntity.parent = current
|
||||||
let path = String(fileURL.path.replacingOccurrences(of: url.path, with: "").drop(while: { $0 == "/" }))
|
passwordEntity.path = String(fileURL.path.dropFirst(url.path.count + 1))
|
||||||
passwordEntity.path = path
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
context.delete(root)
|
context.delete(root)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue