File tree Expand file tree Collapse file tree
Files.xcodeproj/project.xcworkspace/xcshareddata Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+ <plist version =" 1.0" >
4+ <dict >
5+ <key >IDEDidComputeMac32BitWarning </key >
6+ <true />
7+ </dict >
8+ </plist >
Original file line number Diff line number Diff line change @@ -45,6 +45,10 @@ public class FileSystem {
4545 * to perform operations that are supported by both files & folders.
4646 */
4747 public class Item : Equatable , CustomStringConvertible {
48+ #if os(macOS)
49+ /// The attributes of the `FileSystem.Item` on mac os platform.
50+ public typealias Attributes = [ FileAttributeKey : Any ]
51+ #endif
4852 /// Errror type used for invalid paths for files or folders
4953 public enum PathError : Error , Equatable , CustomStringConvertible {
5054 /// Thrown when an empty path was given when initializing a file
@@ -213,6 +217,20 @@ public class FileSystem {
213217 fileprivate let kind : Kind
214218 fileprivate let fileManager : FileManager
215219
220+ #if os(macOS)
221+ /// The file attributes of the item on file system.
222+ @available ( macOS 10 . 5 , * )
223+ public var attributes : Attributes ? {
224+ get {
225+ return try ? fileManager. attributesOfItem ( atPath: path)
226+ }
227+
228+ set {
229+ try ? fileManager. setAttributes ( newValue ?? [ : ] , ofItemAtPath: path)
230+ }
231+ }
232+ #endif
233+
216234 fileprivate init ( path: String , kind: Kind , using fileManager: FileManager ) throws {
217235 guard !path. isEmpty else {
218236 throw PathError . empty
You can’t perform that action at this time.
0 commit comments