At minimum, I suppose the following expressions should be valid:{{~}} # home{{/}} # os.sep{{..}} # parent directory.
And combinations of the above:{{../..}}{{~/}}
Imo path expressions probably should be allowed only at the start of filenames. I don't see how they could be useful in other positions.
Leo already handles "~", so we don't need "{{~}}".
We don't need {{sep}} if the handling code makes the adjustment for "/" vs "\" automatically.
This would be highly desirable anyway because sometimes the best way to get the right path is to copy it in the OS's file browser and paste it in directly which will insert native path separators. Changing them all is a pain and I find it to be error prone. And I have sometimes ended up with a mix of separator types. Leo should handle this case automatically, adjusting the separators as needed for the OS.
I agree that ".." steps should be handled correctly but I don't see that they need to be enclosed in braces.
We should try for maximum readability and clarity in the path expressions.
In my experience, the biggest need, apart from the separators, is to adjust the path prefix (the entire path up to but not including the file name) from one system to another.
To me it seems that one capability would be to have conditional expressions. For example:@clean {windows: c:\tom\devel\llm; linux: ~/Test/leo/llm}/small_llm_1.py
Leo already handles "~", so we don't need "{{~}}".
We definitely need to have a transition strategy so we don't kill anyone's existing outlines.
Maybe it can be enabled by a setting that initially will have the value True but in later releases defaults to False:@bool use-old-path-expressions = False
- I really hope you don't choose '*' for such a feature.
I can use {{sep}}home{{sep}}myusername{{sep}}tmp{{sep}}filename.txt
"*" is so widely used as a wildcard for any string that it would be confusing to use it in another way.
Then I could write, for example:@file {{leoDir}}/plugins/new_plugin.py@file ~/.leo/themes/tbp_new_theme.leo # or {{homeLeoDir}}/themes/tbp_new_theme.leo
1. I don't see any need to use the expression "{{~}}". Just using "~" works now.
os.path.normpath(os.path.join(
os.path.dirname(c.fileName()), path))
Excellent! And if Leo were to export, say, LEODIR, which would be the leo directory, then there would not be a need for {leoDir} since one could write something like@file $LEODIR/themes/vr3/rst-dark.cssI like it.
did the work that got done here ever get documented?
Edward made some changes during this thread, IIRC.