But in your snippet, you also use "." without (apparently) changing it.
import os
from subprocess import run
path = g.fullPath(c, p) or os.path.abspath('.')
cmd = ['explorer.exe', '.']
run(cmd)
How is that supposed to work? Wouldn't you want to use *path* instead of
"."?
On Tuesday, April 6, 2021 at 5:18:14 PM UTC-4 [email protected] wrote:
> But I suppose it would be better to use a more comprehensive method in
> case you accidentally delete this "feature" in the future.
>
> On Tuesday, April 6, 2021 at 5:16:54 PM UTC-4 [email protected] wrote:
>
>> Well, it's more than that. Using "." works for @path subtrees that are
>> not even on the same drive (that is, Windows drive) as the leo outline they
>> are in. It's not just that "." sends you to the directory, say for the
>> workbook in *%USERPROFILE%\.leo* (Windows). In the workbook outline at
>> that location, for any of the following nodes begin selected, the
>> command(s) go to the right directory:
>>
>> - head
>> - @path d:\temp
>> @path dir_1
>> @path dir_2
>> @clean test.txt
>>
>> On Tuesday, April 6, 2021 at 4:14:46 PM UTC-4 Edward K. Ream wrote:
>>
>>> On Tue, Apr 6, 2021 at 10:29 AM [email protected] <[email protected]>
>>> wrote:
>>>
>>>>
>>>>
>>>> On Tuesday, April 6, 2021 at 10:14:19 AM UTC-4 Edward K. Ream wrote:
>>>>
>>>>> On Tue, Apr 6, 2021 at 7:15 AM [email protected] <[email protected]>
>>>>> wrote:
>>>>>
>>>>> BTW, I have put a button into MyLeoSettings.leo that will open a file
>>>>>> manager window (File Explorer on Windows) at the current directory of
>>>>>> the
>>>>>> selected node, whatever it is. This has been awfully handy.
>>>>>>
>>>>>
>>>>> Great idea. However, I don't understand how '.' gets bound to the
>>>>> directory of the selected node. Here is tested code for Windows that
>>>>> works
>>>>> as I expect.
>>>>>
>>>>
>>>> I don't understand it either, but it works as I showed on both Linux
>>>> and Windows. Sure makes for simple code! These commands have worked this
>>>> way for a long time (years). A great undocumented feature!
>>>>
>>>
>>> I strongly suspect that the code works by accident because loading a
>>> .leo file effectively changes ".". But outlines like LeoPyRef.leo contains
>>> files in several directories. There is no way the OS can know how to relate
>>> '.' to the various directories.
>>>
>>> In short, I would recommend my code ;-)
>>>
>>> Edward
>>>
>>
--
You received this message because you are subscribed to the Google Groups
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/leo-editor/a097fbe4-1e90-496e-a6b3-6577f706850en%40googlegroups.com.