Open dgelessus opened 7 years ago
Nice. You could do the latter in your startup script. I do however understand the desire to make it a builtin function/method.
It's not that easy as it sounds. I highly recommend to read Designing for Documents in iCloud. If you expose this to the Pythonista user, they'll start writing / reading to / from this location and it can cause issues. BTW I filled similar issues for bookmarks (see #428).
I would rather see overhauled editor
module, which will provide a way how to read / write files to these locations, walks them, ... For example I have similar issue while implementing refactoring in the Black Mamba. I can refactor the whole project (many files at once, rename for example), but I intentionally limit it to the open file only and I do use editor.replace_text
instead of modifying these files directly. That's because of all these coordinators, different approaches how to work with bookmarks, iCloud documents, local documents, ...
It's probably not a good idea from this point of view.
The path seems to be the same on all devices (
/private/var/mobile/Library/Mobile Documents/iCloud~com~omz-software~Pythonista3
), unlike with the local "home" directory, so there's currently no issue with hardcoding it in scripts. That's not very elegant though, and there's no guarantee that this won't change in future Pythonista and/or iOS versions, so it would be nice to have an API to get the iCloud folder path. This could for example be aneditor.get_icloud_path()
function, or anICLOUD_HOME
environment variable.