diff --git a/YAPS/YAPS.xcodeproj/project.pbxproj b/YAPS/YAPS.xcodeproj/project.pbxproj index 22812ad..4a52f69 100644 --- a/YAPS/YAPS.xcodeproj/project.pbxproj +++ b/YAPS/YAPS.xcodeproj/project.pbxproj @@ -328,6 +328,7 @@ "@executable_path/../Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 10.15; + MARKETING_VERSION = 0.1; PRODUCT_BUNDLE_IDENTIFIER = com.adawim.macos.YAPS; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 5.0; @@ -349,6 +350,7 @@ "@executable_path/../Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 10.15; + MARKETING_VERSION = 0.1; PRODUCT_BUNDLE_IDENTIFIER = com.adawim.macos.YAPS; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 5.0; diff --git a/YAPS/YAPS/FinderHelper.swift b/YAPS/YAPS/FinderHelper.swift index 57bfb06..8cae43b 100644 --- a/YAPS/YAPS/FinderHelper.swift +++ b/YAPS/YAPS/FinderHelper.swift @@ -49,7 +49,7 @@ class FinderHelper { var fileList = [YapsFile]() do { - let items = try fm.contentsOfDirectory(at: path, includingPropertiesForKeys: nil, options: .skipsHiddenFiles).filter{ $0.pathExtension == "jpg" || $0.pathExtension == "jpeg" } + let items = try fm.contentsOfDirectory(at: path, includingPropertiesForKeys: [.volumeNameKey, .volumeIsRemovableKey, .volumeIsEjectableKey], options: [.skipsHiddenFiles, .skipsPackageDescendants]).filter{ $0.pathExtension.lowercased() == "jpg" || $0.pathExtension.lowercased() == "jpeg" } var index = 0 for item in items { @@ -149,4 +149,25 @@ class FinderHelper { return URL(fileURLWithPath: fullPathRAW) } + + func listMounts() -> [URL] { + var mounts: [URL] = [URL]() + + let keys: [URLResourceKey] = [.volumeNameKey, .volumeIsRemovableKey, .volumeIsEjectableKey] + let paths = FileManager().mountedVolumeURLs(includingResourceValuesForKeys: keys, options: []) + if let urls = paths { + for url in urls { + let components = url.pathComponents + if components.count > 1 + && components[1] == "Volumes" + && !(components[2].contains("ime") && components[2].contains("achine")) // skip TimeMachine ^^ + { + print(url) + mounts.append(url) + } + } + } + + return mounts + } } diff --git a/YAPS/YAPS/Info.plist b/YAPS/YAPS/Info.plist index 0fc6573..bb24b8a 100644 --- a/YAPS/YAPS/Info.plist +++ b/YAPS/YAPS/Info.plist @@ -17,7 +17,7 @@ CFBundlePackageType $(PRODUCT_BUNDLE_PACKAGE_TYPE) CFBundleShortVersionString - 1.0 + $(MARKETING_VERSION) CFBundleVersion 1 LSApplicationCategoryType diff --git a/YAPS/YAPS/YAPS.entitlements b/YAPS/YAPS/YAPS.entitlements index 649916d..e7a7d62 100644 --- a/YAPS/YAPS/YAPS.entitlements +++ b/YAPS/YAPS/YAPS.entitlements @@ -8,5 +8,7 @@ com.apple.security.files.user-selected.read-write + com.apple.security.files.bookmarks.app-scope +