Skip to content

Commit 1563475

Browse files
committed
[feat]: file manager features
1 parent b8a7bc5 commit 1563475

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)