ref: parentDir()
This commit is contained in:
@@ -117,7 +117,7 @@ extension AppIcon {
|
|||||||
case .Archive, .Extension:
|
case .Archive, .Extension:
|
||||||
for iconPath in iconList {
|
for iconPath in iconList {
|
||||||
let fileName = iconPath.components(separatedBy: "/").last!
|
let fileName = iconPath.components(separatedBy: "/").last!
|
||||||
let parentDir = meta.effectiveUrl("Resources", iconPath).deletingLastPathComponent().path
|
let parentDir = meta.effectiveUrl("Resources", iconPath).parentDir().path
|
||||||
guard let files = try? FileManager.default.contentsOfDirectory(atPath: parentDir) else {
|
guard let files = try? FileManager.default.contentsOfDirectory(atPath: parentDir) else {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ private func recursiveSearchInfoPlist(_ url: URL) -> URL? {
|
|||||||
if let subfiles = try? FileManager.default.contentsOfDirectory(at: current, includingPropertiesForKeys: []) {
|
if let subfiles = try? FileManager.default.contentsOfDirectory(at: current, includingPropertiesForKeys: []) {
|
||||||
for fname in subfiles {
|
for fname in subfiles {
|
||||||
if fname.lastPathComponent == "Info.plist" {
|
if fname.lastPathComponent == "Info.plist" {
|
||||||
return fname.deletingLastPathComponent()
|
return fname.parentDir()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
queue.append(contentsOf: subfiles)
|
queue.append(contentsOf: subfiles)
|
||||||
|
|||||||
@@ -9,4 +9,9 @@ extension URL {
|
|||||||
@inlinable func exists() -> Bool {
|
@inlinable func exists() -> Bool {
|
||||||
FileManager.default.fileExists(atPath: self.path)
|
FileManager.default.fileExists(atPath: self.path)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Returns URL by deleting last path component
|
||||||
|
@inlinable func parentDir() -> URL {
|
||||||
|
self.deletingLastPathComponent()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user