iCloud/Google Drive/Dropbox
Hey SF fam!
Looking for some insight on ways to deal with cloud folders (iCloud Drive, Dropbox, etc), specifically when creating sessions.directories to them. I've never used iCloud Drive before, and I don't sync these services with my computer. Are the folder paths/structures different from normal folders? Any insight is appreciated. Thanks!
- Chris Shaw @Chris_Shaw2022-04-27 00:11:30.953Z
Using iCloud is tricky because of the way apple presents the path to SF. I'd go into more detail but it gets pretty complicated pretty fast. Essentially the path to iCloud is buried deep inside the user library but is presented to the user as a simple drive path - confusing to code around.
DropBox and Google drive are more straight forward because their paths are dictated by the user settings in each app.Ryan DeRemer @Ryan_DeRemer
I'll have to do some research on iCloud. Is the general consensus just to not use iCloud then? What makes it complicated for me is the script I wrote for creating sessions that I published. Another SF user is having errors at the point in the script where it chooses the Save path. It currently uses either the current open Finder window path to save the new session in, or defaults to the desktop if no window is open. I'm realizing that anyone who uses iCloud drive for the Desktop, Documents, etc is likely going to have issues with it if the path to the desktop isn't the classic /Users/~/Desktop. Is the iCloud desktop path at least somewhat universal?
Chris Shaw @Chris_Shaw2022-04-27 01:33:18.548Z
I don't think so.
@Andrew_Scheps has a solution for this but it is fairly complicated. He could explain better than I could.Chris Shaw @Chris_Shaw2022-04-27 01:38:55.362Z
If iCloud is being used the path to it is ~/Library/Mobile Documents/com~apple~CloudDocs/.
You'll need to figure out someway to determine if the user is creating sessions in iCloud then use this as your base path.Ryan DeRemer @Ryan_DeRemer
It would seem that even when the Dekstop and Documents folders are on iCloud Drive, the paths remain the same. The iCloud Drive root directory is in the User Library, but there must be some kind of internal alias that links the Desktop and Docs folders to the local home folder.