Using Sync with Leo on Win/MacOs

73 views
Skip to first unread message

Israel Hands

unread,
Jun 4, 2019, 1:58:12 PM6/4/19
to leo-editor
Hi, 

I use Sync rather than dropbox for my shared data and Sync works by having a directory on your machine that is nominated to be 'synced' to the cloud storage. Which is fine but  I quite like having text files in that shared folder that are used with @auto in a leo file. However because Win and MacOs refer to directory paths differently I haven't worked out how to have Leo under MacOs and Win 'see' the same file from the same @auto node. I hope that makes sense. I wouldn't mind keeping the text files in the same directory as the Leo files is there a way of making this work?

ta

IH

jkn

unread,
Jun 4, 2019, 3:40:56 PM6/4/19
to leo-editor
I do something like this, under Linux and Windows. I have @file nodes with names like this:

    @file .{{sep}}docs{{sep}}myfilename.mwiki

(this is a 'mediawiki' file).

The {{sep}} gets magically converted to '\' under Windows and '/' under Linux. I think there are other keywords available with this {{...}}syntax; look for a thread "cross-platform file references - how to deal with?"

As shown this keeps the @file within the main Leo file directory, under a 'docs' subdirectory in this case; I use it with Owncloud in a similar way to your use of Sync. I presume that with the sue of symbolic links, under Linux at least one could put them somewhere else. However I haven't yet pursued this.

    HTH
    Jon N




Israel Hands

unread,
Jun 5, 2019, 5:17:50 AM6/5/19
to leo-editor
thanks Jon - very helpful - will chase this!

IH

Edward K. Ream

unread,
Jun 5, 2019, 6:30:02 AM6/5/19
to leo-editor
On Tue, Jun 4, 2019 at 2:40 PM jkn <jkn...@nicorp.f9.co.uk> wrote:
I do something like this, under Linux and Windows. I have @file nodes with names like this:

    @file .{{sep}}docs{{sep}}myfilename.mwiki

The {{sep}} gets magically converted to '\' under Windows and '/' under Linux. I think there are other keywords available with this {{...}}syntax; look for a thread "cross-platform file references - how to deal with?"

FYI, searching reveals that the magic happens in the following functions:

- g.os_path_expandExpression.
- replace_path_expression.

Two more visible wrappers around os.path methods use the above functions:

g.os_path_finalize and g.os_path_finalize_join.

Edward

Matt Wilkie

unread,
Jun 13, 2019, 2:36:12 AM6/13/19
to leo-editor
Make all the paths relative to the .leo file (don't start with slash or drive letter), and use forward slashes. They work on Windows and 'nix (because python converts them automatically).

@path projects/Something

# works everywhere

matt


Matt Wilkie

unread,
Jun 13, 2019, 1:10:52 PM6/13/19
to leo-editor
Another convention I use to make .leo files more portable is to avoid folders in @file/@auto headlines, put them in parent nodes instead. I used to have a snippet that set the initial path from an environment variable or presence/lack-of a folder but I can't find it at the moment.

[ ] Scripts
   
@path utils/printing
       
[ ] @file set-env-ghostscript.bat
Reply all
Reply to author
Forward
0 new messages