瀏覽代碼

fix(ios): unhide logseq folder in iCloud Drive

Simplily adding an empty .logseq file at the container root to reveal
the logseq folder
leizhe 3 年之前
父節點
當前提交
2c1b32e2b5
共有 1 個文件被更改,包括 13 次插入0 次删除
  1. 13 0
      ios/App/App/FileContainer.swift

+ 13 - 0
ios/App/App/FileContainer.swift

@@ -32,6 +32,19 @@ public class FileContainer: CAPPlugin, UIDocumentPickerDelegate {
             }
         }
 
+        let str = ""
+        guard let filename = self.containerUrl?.appendingPathComponent(".logseq") else {
+            return
+        }
+        
+        if !FileManager.default.fileExists(atPath: filename.path) {
+            do {
+                try str.write(to: filename, atomically: true, encoding:  String.Encoding.utf8)
+            }
+            catch {
+                // failed to write file – bad permissions, bad filename, missing permissions, or more likely it can't be converted to the encoding
+            }
+        }
         self._call?.resolve([
             "path": self.containerUrl?.path
                             ])