Skip to content

Commit bf60fef

Browse files
feat: add helper in fs to identify symlinks
1 parent 999fb0d commit bf60fef

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Sources/SwiftlyCore/FileManager+FilePath.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,10 @@ public enum FileSystem {
8383
try FileManager.default.destinationOfSymbolicLink(atPath: atPath)
8484
}
8585

86+
public static func isSymLink(atPath: FilePath) async throws -> Bool {
87+
try FileManager.default.attributesOfItem(atPath: atPath.string)[.type] as? FileAttributeType == .typeSymbolicLink
88+
}
89+
8690
public static func symlink(atPath: FilePath, linkPath: FilePath) async throws {
8791
try FileManager.default.createSymbolicLink(atPath: atPath, withDestinationPath: linkPath)
8892
}

0 commit comments

Comments
 (0)