Please test the ekr-1903-path branch

41 views
Skip to first unread message

Edward K. Ream

unread,
Apr 23, 2021, 7:44:32 AM4/23/21
to leo-editor
This branch completes #1903, with PR #1005.  I'll merge the ekr-1903-path branch into devel in a few days, after I return from a short vacation.  Please report any problems immediately.

The work is a thorough housecleaning of the wrappers (in leoGlobals.py) for os.path methods. I began this work soon after completing #1900, which, for the first time, allows ~ in @<file> nodes.

Simplifying these wrappers has been on my mind for years. I even briefly considered eliminating these wrappers, but that would be a very bad idea, for reasons explained in #1903. In brief, the wrappers do more (in some cases, a lot more) than the corresponding os.path functions. This surprised me :-)

Summary

The ekr-1903-path branch is a long overdue housecleaning. It should work exactly as before. Please let me know if it doesn't.

Edward



tbp1...@gmail.com

unread,
Apr 23, 2021, 10:58:00 PM4/23/21
to leo-editor
This appears in brief testing to work as intended.  The most tricky thing I tested:

- ekr-path-test
    - @path ~\ekr-test
        -@file ~\ekr-tricky-test\test1.txt

What should be the directory path for test1.txt?  I would expect that the ~\ekr-tricky-test\ should override the path in the @path node because of the leading "~" (which ought to denote an absolute path), and that is what happened. All the directories got created when I saved the outline.

Tested with:

Leo 6.4-devel, ekr-1903-path branch, build 43e51f1cef
2021-04-22 19:16:07 -0500
Python 3.8.9, PyQt version 5.15.1
Windows 10 AMD64 (build 10.0.19041) SP0

Edward K. Ream

unread,
Apr 27, 2021, 9:36:53 AM4/27/21
to leo-editor
On Fri, Apr 23, 2021 at 9:58 PM tbp1...@gmail.com <tbp1...@gmail.com> wrote:
This appears in brief testing to work as intended.  The most tricky thing I tested:

- ekr-path-test
    - @path ~\ekr-test
        -@file ~\ekr-tricky-test\test1.txt

What should be the directory path for test1.txt

Thanks for this report. Your test is better than mine.
I would expect that the ~\ekr-tricky-test\ should override the path in the @path node because of the leading "~" (which ought to denote an absolute path), and that is what happened. All the directories got created when I saved the outline.

I agree with your analysis. The behaviour should be similar to:

os.path.join(finalize('~\ekr-test'),  finalize('~\ekr-tricky-test\test1.txt'))

where finalize is g.os_path_finalize. Or so I remember :-)

Edward

Edward K. Ream

unread,
Apr 27, 2021, 9:44:49 AM4/27/21
to leo-editor
On Friday, April 23, 2021 at 6:44:32 AM UTC-5 Edward K. Ream wrote:
This branch completes #1903, with PR #1005.  I'll merge the ekr-1903-path branch into devel in a few days, after I return from a short vacation. 

Done.

Edward
Reply all
Reply to author
Forward
0 new messages