Skip to content

Commit 8e7b6e4

Browse files
committed
[feat]: filesystem item init
1 parent d80e6c3 commit 8e7b6e4

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Sources/ScriptToolkit/FileSystemItemExtension.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ import SwiftShell
1111

1212
public extension FileSystem.Item {
1313

14+
public convenience init(path: String, using fileManager: FileManager = .default) throws {
15+
try self.init(path: path, kind: FileManager.default.itemKind(atPath: path) ?? .file, using: fileManager)
16+
}
17+
1418
public func modificationDate() throws -> Date {
1519

1620
let fileAttributes = try FileManager.default.attributesOfItem(atPath: path) as [FileAttributeKey: Any]

0 commit comments

Comments
 (0)