Changed iCloud folder recognition
This commit is contained in:
@@ -39,7 +39,18 @@ class ICloudManager {
|
|||||||
}catch {
|
}catch {
|
||||||
return .none
|
return .none
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static public func inICloudContainer(url : URL?) -> Bool {
|
||||||
|
guard let url = url else { return false }
|
||||||
|
|
||||||
|
for component in url.pathComponents {
|
||||||
|
if relative_seperator.count > 0 && component == relative_seperator[0] {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
private init() {
|
private init() {
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ struct ModalAddConsoleToLibrary : View {
|
|||||||
let selectedFile : URL = try result.get().first!
|
let selectedFile : URL = try result.get().first!
|
||||||
|
|
||||||
//It seems that isUbiquitousItem checks if the file is contained in the Apps iCloud folder
|
//It seems that isUbiquitousItem checks if the file is contained in the Apps iCloud folder
|
||||||
if (FileManager.default.isUbiquitousItem(at: selectedFile)) {
|
if (ICloudManager.inICloudContainer(url: selectedFile)) {
|
||||||
self.modalConsoleLogoICloudPath = ICloudManager.relativePathFrom(url: selectedFile)
|
self.modalConsoleLogoICloudPath = ICloudManager.relativePathFrom(url: selectedFile)
|
||||||
|
|
||||||
print("Selected Image in iCloud Path \(self.modalConsoleLogoICloudPath ?? "n/a")")
|
print("Selected Image in iCloud Path \(self.modalConsoleLogoICloudPath ?? "n/a")")
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ struct ConsoleEditView: View {
|
|||||||
let selectedFile : URL = try result.get().first!
|
let selectedFile : URL = try result.get().first!
|
||||||
|
|
||||||
//It seems that isUbiquitousItem checks if the file is contained in the Apps iCloud folder
|
//It seems that isUbiquitousItem checks if the file is contained in the Apps iCloud folder
|
||||||
if (FileManager.default.isUbiquitousItem(at: selectedFile)) {
|
if (ICloudManager.inICloudContainer(url: selectedFile)) {
|
||||||
console.logo_icloud_path = ICloudManager.relativePathFrom(url: selectedFile)
|
console.logo_icloud_path = ICloudManager.relativePathFrom(url: selectedFile)
|
||||||
|
|
||||||
print("Selected Image in iCloud Path \(console.logo_icloud_path ?? "n/a")")
|
print("Selected Image in iCloud Path \(console.logo_icloud_path ?? "n/a")")
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ struct GameDetailView : View {
|
|||||||
let selectedFile : URL = try result.get().first!
|
let selectedFile : URL = try result.get().first!
|
||||||
|
|
||||||
//It seems that isUbiquitousItem checks if the file is contained in the Apps iCloud folder
|
//It seems that isUbiquitousItem checks if the file is contained in the Apps iCloud folder
|
||||||
if (FileManager.default.isUbiquitousItem(at: selectedFile)) {
|
if (ICloudManager.inICloudContainer(url: selectedFile)) {
|
||||||
game.cover_icloud_path = ICloudManager.relativePathFrom(url: selectedFile)
|
game.cover_icloud_path = ICloudManager.relativePathFrom(url: selectedFile)
|
||||||
|
|
||||||
print("Selected Image in iCloud Path \(game.cover_icloud_path ?? "n/a")")
|
print("Selected Image in iCloud Path \(game.cover_icloud_path ?? "n/a")")
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ struct ModalAddGameSeries : View {
|
|||||||
let selectedFile : URL = try result.get().first!
|
let selectedFile : URL = try result.get().first!
|
||||||
|
|
||||||
//It seems that isUbiquitousItem checks if the file is contained in the Apps iCloud folder
|
//It seems that isUbiquitousItem checks if the file is contained in the Apps iCloud folder
|
||||||
if (FileManager.default.isUbiquitousItem(at: selectedFile)) {
|
if (ICloudManager.inICloudContainer(url: selectedFile)) {
|
||||||
self.modalGameSeriesCover = ICloudManager.relativePathFrom(url: selectedFile)
|
self.modalGameSeriesCover = ICloudManager.relativePathFrom(url: selectedFile)
|
||||||
|
|
||||||
print("Selected Image in iCloud Path \(self.modalGameSeriesCover ?? "n/a")")
|
print("Selected Image in iCloud Path \(self.modalGameSeriesCover ?? "n/a")")
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ struct GameSeriesEditView: View {
|
|||||||
let selectedFile : URL = try result.get().first!
|
let selectedFile : URL = try result.get().first!
|
||||||
|
|
||||||
//It seems that isUbiquitousItem checks if the file is contained in the Apps iCloud folder
|
//It seems that isUbiquitousItem checks if the file is contained in the Apps iCloud folder
|
||||||
if (FileManager.default.isUbiquitousItem(at: selectedFile)) {
|
if (ICloudManager.inICloudContainer(url: selectedFile)) {
|
||||||
gameSeries.cover_icloud_path = ICloudManager.relativePathFrom(url: selectedFile)
|
gameSeries.cover_icloud_path = ICloudManager.relativePathFrom(url: selectedFile)
|
||||||
|
|
||||||
print("Selected Image in iCloud Path \(gameSeries.cover_icloud_path ?? "n/a")")
|
print("Selected Image in iCloud Path \(gameSeries.cover_icloud_path ?? "n/a")")
|
||||||
|
|||||||
Reference in New Issue
Block a user