Re: Can't find the path!

2021-04-07 Thread Edward K. Ream
On Wed, Apr 7, 2021 at 1:51 PM tbp1...@gmail.com wrote: > Here is the simplest code I have been able to devise that does exactly > what I want - getting the directory of a node - if you want to avoid using > "." > Thanks. Looks good to me. Edward -- You received this message because you are

Re: Can't find the path!

2021-04-07 Thread tbp1...@gmail.com
Yes, normpath uses backslashes on Windows. But it only returns something for a file, not for a node that is an *@path* node and not a file. For opening a directory, that's not quite what we want, and we still need the os.getcwd() to get the non-file directory paths anyway. So we might as wel

Re: Can't find the path!

2021-04-07 Thread Edward K. Ream
On Tuesday, April 6, 2021 at 9:51:34 PM UTC-5 tbp1...@gmail.com wrote: > Maybe this is beating the a dead horse, but os.getcwd() returns the > actual directory of the selected node - verified by test. It is as if when > a node is selected, Leo changes the current directory to the path for that

Re: Can't find the path!

2021-04-07 Thread Edward K. Ream
On Tue, Apr 6, 2021 at 9:51 PM tbp1...@gmail.com wrote: > Maybe this is beating the a dead horse, but os.getcwd() returns the > actual directory of the selected node - verified by test. It is as if when > a node is selected, Leo changes the current directory to the path for that > node. That wou

Re: Can't find the path!

2021-04-07 Thread Edward K. Ream
On Tue, Apr 6, 2021 at 4:58 PM tbp1...@gmail.com wrote: > But in your snippet, you also use "." without (apparently) changing it. > Oops. Edward -- You received this message because you are subscribed to the Google Groups "leo-editor" group. To unsubscribe from this group and stop receiving

Re: Can't find the path!

2021-04-06 Thread tbp1...@gmail.com
Maybe this is beating the a dead horse, but os.getcwd() returns the actual directory of the selected node - verified by test. It is as if when a node is selected, Leo changes the current directory to the path for that node. That would explain why "." works as well. I don't know if this behavio

Re: Can't find the path!

2021-04-06 Thread tbp1...@gmail.com
OK, after some more testing and thought: 1. Edward's example can't work as claimed, even if '.' is replaced by *path*. The expression for *path* returns a path that a) has forward slashes and won't work in Windows when you open explorer on it - confirmed by test with both a console and in Leo

Re: Can't find the path!

2021-04-06 Thread tbp1...@gmail.com
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, 2

Re: Can't find the path!

2021-04-06 Thread tbp1...@gmail.com
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 tbp1...@gmail.com wrote: > Well, it's more than that. Using "." works for @path subtrees that are > not even on the sa

Re: Can't find the path!

2021-04-06 Thread tbp1...@gmail.com
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 tha

Re: Can't find the path!

2021-04-06 Thread Edward K. Ream
On Tue, Apr 6, 2021 at 10:29 AM tbp1...@gmail.com 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 tbp1...@gmail.com >> wrote: >> >> BTW, I have put a button into MyLeoSettings.leo that will open a file >>> manager window (File

Re: Can't find the path!

2021-04-06 Thread tbp1...@gmail.com
It worked on two VMs I tried (Mint and Debian - I only have Debian-derived VMs at the moment). Glad to learn about xdg-open, thanks. On Tuesday, April 6, 2021 at 1:23:35 PM UTC-4 jkn wrote: > > Neat! I will try this. > > BTW, I think 'xdg-open' as a command should do this in a > window-manager

Re: Can't find the path!

2021-04-06 Thread jkn
Neat! I will try this. BTW, I think 'xdg-open' as a command should do this in a window-manager-agnostic way under (most?) linuxes. I'll give it a try... On Tuesday, April 6, 2021 at 1:15:52 PM UTC+1 tbp1...@gmail.com wrote: > Here's what I have been doing to create files in directory trees. I

Re: Can't find the path!

2021-04-06 Thread tbp1...@gmail.com
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 tbp1...@gmail.com > 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

Re: Can't find the path!

2021-04-06 Thread Jacob Peck
I believe '.' is interpreted in the context of the OS -- which on both Linux and Windows evaluates to the same as the current working directory. I am unsure how or why the 'run(cmd)' portion is executed in the context of the current node's path, but if it is, '.' should expand at the OS level to t

Re: Can't find the path!

2021-04-06 Thread Edward K. Ream
On Tue, Apr 6, 2021 at 7:15 AM tbp1...@gmail.com wrote: Here's what I have been doing to create files in directory trees. It seems > much simpler. > Thanks for this tip. I don't create many directories myself, and so I just create the directories first in the file manager. BTW, I have put a b

Re: Can't find the path!

2021-04-06 Thread tbp1...@gmail.com
Here's what I have been doing to create files in directory trees. It seems much simpler. 1. Create a node with the headline *@path d:\temp\aaa* 2. Create a path with the headline *@path bbb*. Indent it right, under the *aaa* one. 3. ... and so on 4. However far down in the tree you like, create

Re: Can't find the path!

2021-04-06 Thread Israel Hands
Thanks Edward - I have added the line about create non existing directories to the mysettings files. Here's the current behaviour... I have an @path node representing a directory 1 I right click on the @path node and select active-path-make-dir from the path option. Up comes the name directory

Re: Can't find the path!

2021-04-05 Thread Edward K. Ream
On Mon, Apr 5, 2021 at 10:19 AM jkn wrote: > ooh, I didn't know about that setting - thanks! > You're welcome. 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 ema

Re: Can't find the path!

2021-04-05 Thread jkn
ooh, I didn't know about that setting - thanks! J^n On Monday, April 5, 2021 at 11:56:23 AM UTC+1 Edward K. Ream wrote: > On Mon, Apr 5, 2021 at 5:18 AM Israel Hands wrote: > > [Am] I missing a way of creating a directory and populating it with files >> from within Leo? >> > > Have you tried

Re: Can't find the path!

2021-04-05 Thread Edward K. Ream
On Mon, Apr 5, 2021 at 5:18 AM Israel Hands wrote: [Am] I missing a way of creating a directory and populating it with files > from within Leo? > Have you tried this? @bool create-nonexistent-directories = True Edward -- You received this message because you are subscribed to the Google Grou

Can't find the path!

2021-04-05 Thread Israel Hands
I have an @path node pointing to a directory on a disk. I want to make a new sub directory which the Path plugin allows me to do. But when I save the outline the log file warns me- Path will be created if a file is saved on it So the OS hasn't at this actually created the directory. If I make a