We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b8a7bc5 commit 1563475Copy full SHA for 1563475
Sources/ScriptToolkit/FileManagerExtension.swift
@@ -0,0 +1,32 @@
1
+//
2
+// FileManagerExtension.swift
3
+// ScriptToolkit
4
5
+// Created by Dan Cech on 27.02.2019.
6
7
+
8
+import Foundation
9
+import Files
10
11
+public extension FileManager {
12
+ func itemKind(atPath path: String) -> FileSystem.Item.Kind? {
13
+ var objCBool: ObjCBool = false
14
15
+ guard fileExists(atPath: path, isDirectory: &objCBool) else {
16
+ return nil
17
+ }
18
19
+ if objCBool.boolValue {
20
+ return .folder
21
22
23
+ return .file
24
25
+}
26
27
+public extension FileSystem.Item {
28
+ enum Kind {
29
+ case file
30
+ case folder
31
32
0 commit comments