diff --git a/FileProvider.podspec b/FileProvider.podspec index 9f9ea08..0cad8d5 100644 --- a/FileProvider.podspec +++ b/FileProvider.podspec @@ -16,7 +16,7 @@ Pod::Spec.new do |s| # s.name = "FileProvider" - s.version = "0.11.1" + s.version = "0.11.2" s.summary = "FileManager replacement for Local and Remote (WebDAV/Dropbox/OneDrive/SMB2) files on iOS and macOS." # This description is used to generate tags and improve search results. diff --git a/FileProvider.xcodeproj/project.pbxproj b/FileProvider.xcodeproj/project.pbxproj index d0a498a..92a1fe3 100644 --- a/FileProvider.xcodeproj/project.pbxproj +++ b/FileProvider.xcodeproj/project.pbxproj @@ -603,7 +603,7 @@ 799396601D48B7BF00086753 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - BUNDLE_VERSION_STRING = 0.11.1; + BUNDLE_VERSION_STRING = 0.11.2; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_EMPTY_BODY = YES; @@ -633,7 +633,7 @@ 799396611D48B7BF00086753 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - BUNDLE_VERSION_STRING = 0.11.1; + BUNDLE_VERSION_STRING = 0.11.2; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_EMPTY_BODY = YES; diff --git a/Sources/FileProvider.swift b/Sources/FileProvider.swift index b539378..daee259 100644 --- a/Sources/FileProvider.swift +++ b/Sources/FileProvider.swift @@ -207,6 +207,7 @@ extension FileProviderBasic { return path.trimmingCharacters(in: pathTrimSet).addingPercentEncoding(withAllowedCharacters: .urlPathAllowed)! } + @available(*, deprecated, message: "Use FileProvider.url(of:).absoluteURL instead.") public func absoluteURL(_ path: String? = nil) -> URL { return url(of: path).absoluteURL } @@ -295,8 +296,8 @@ extension FileProviderBasic { return NSError(domain: domain, code: code.rawValue, userInfo: [NSURLErrorFailingURLErrorKey: fileURL, NSURLErrorFailingURLStringErrorKey: fileURL.absoluteString]) } - internal func NotImplemented() { - assert(false, "method not implemented") + internal func NotImplemented(_ fn: String = #function, file: StaticString = #file) { + assert(false, "\(fn) method is not yet implemented. \(file)") } internal func resolve(dateString: String) -> Date? { diff --git a/Sources/LocalHelper.swift b/Sources/LocalHelper.swift index 4b52026..691cd8a 100644 --- a/Sources/LocalHelper.swift +++ b/Sources/LocalHelper.swift @@ -33,8 +33,8 @@ public final class LocalFileObject: FileObject { public convenience init?(fileWithURL fileURL: URL) { do { - let values = try fileURL.resourceValues(forKeys: [.nameKey, .fileSizeKey, .fileAllocatedSizeKey, .creationDateKey, .contentModificationDateKey, .fileResourceTypeKey, .isHiddenKey, .isWritableKey, .typeIdentifierKey]) - self.init(url: fileURL, name: values.name ?? fileURL.lastPathComponent, path: fileURL.path) + let values = try fileURL.resourceValues(forKeys: [.nameKey, .fileSizeKey, .fileAllocatedSizeKey, .creationDateKey, .contentModificationDateKey, .fileResourceTypeKey, .isHiddenKey, .isWritableKey, .typeIdentifierKey, .generationIdentifierKey]) + self.init(url: fileURL, name: values.name ?? fileURL.lastPathComponent, path: fileURL.relativePath) for (key, value) in values.allValues { self.allValues[key.rawValue] = value } @@ -51,6 +51,14 @@ public final class LocalFileObject: FileObject { allValues[URLResourceKey.fileAllocatedSizeKey.rawValue] = Int(exactly: newValue) ?? Int.max } } + + open var rev: String? { + get { + let data = allValues[URLResourceKey.generationIdentifierKey.rawValue] as? Data + return data?.map { String(format: "%02hhx", $0) }.joined() + } + } + } internal class LocalFolderMonitor {