Re: Strange g.os_path_abspath(c.fileName) behaviour...

2014-12-04 Thread Edward K. Ream
On Thu, Dec 4, 2014 at 11:12 AM, Davy Cottet cottet.d...@gmail.com wrote:


 For my experimental version of leoDist.leo, I use abspath(c.fileName) to
 get the path of the opened outline, in this case /path/of/leo/dist


​I don't know why this weird example has problem, but you should use::

 abspath(c.fileName())​

not::

abspath(c.fileName)

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 leo-editor+unsubscr...@googlegroups.com.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at http://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.


Re: Strange g.os_path_abspath(c.fileName) behaviour...

2014-12-04 Thread 'Terry Brown' via leo-editor
On Thu, 4 Dec 2014 09:12:55 -0800 (PST)
Davy Cottet cottet.d...@gmail.com wrote:

 Hi,
 For my experimental version of leoDist.leo, I use abspath(c.fileName)
 to get the path of the opened outline, in this case /path/of/leo/dist
 I've noticed a strange behaviour, that unfortunately implies bugs.
 Maybe can you reproduce it and explain to me :
 
 - put this code into a @button :
 g.es(c.fileName)
 g.es(g.os_path_abspath(c.fileName))
 
 - clic on this button, you should get the following :
 
  bound method Commands.fileName of Commander 139748683191376: 
  u'/path/to/your/outline.leo'
  /path/to/your
 
 That's OK, that's what I want.
 
 - Now create a node *@path test*, select it and click on the button.
 You should get this :
 
  bound method Commands.fileName of Commander 139748683191376: 
  u'/path/to/your/outline.leo'
  /path/to/your/*test*
 
 
 Why does it return /path/to/your/*test *and not /path/to/your ?

Unless I'm missing something, that's what @path nodes are supposed to
do.  If you created a @edit file.txt under the @path node, the text
directory would be created for saving file.txt in.

http://leoeditor.com/directives.html

Cheers -Terry

-- 
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 leo-editor+unsubscr...@googlegroups.com.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at http://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.


Re: Strange g.os_path_abspath(c.fileName) behaviour...

2014-12-04 Thread 'Terry Brown' via leo-editor
On Thu, 4 Dec 2014 11:35:38 -0600
'Terry Brown' via leo-editor leo-editor@googlegroups.com wrote:

 On Thu, 4 Dec 2014 09:12:55 -0800 (PST)
 Davy Cottet cottet.d...@gmail.com wrote:
 
  Hi,
  For my experimental version of leoDist.leo, I use
  abspath(c.fileName) to get the path of the opened outline, in this
  case /path/of/leo/dist I've noticed a strange behaviour, that
  unfortunately implies bugs. Maybe can you reproduce it and explain
  to me :
  
  - put this code into a @button :
  g.es(c.fileName)
  g.es(g.os_path_abspath(c.fileName))
  
  - clic on this button, you should get the following :
  
   bound method Commands.fileName of Commander 139748683191376: 
   u'/path/to/your/outline.leo'
   /path/to/your
  
  That's OK, that's what I want.
  
  - Now create a node *@path test*, select it and click on the button.
  You should get this :
  
   bound method Commands.fileName of Commander 139748683191376: 
   u'/path/to/your/outline.leo'
   /path/to/your/*test*
  
  
  Why does it return /path/to/your/*test *and not /path/to/your ?
 
 Unless I'm missing something, that's what @path nodes are supposed to

And indeed I was missing that you were using the method reference
c.fileName as a string reference :-)

Cheers -Terry

 do.  If you created a @edit file.txt under the @path node, the text
 directory would be created for saving file.txt in.
 
 http://leoeditor.com/directives.html
 
 Cheers -Terry
 

-- 
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 leo-editor+unsubscr...@googlegroups.com.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at http://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.


Re: Strange g.os_path_abspath(c.fileName) behaviour...

2014-12-04 Thread Edward K. Ream
On Thu, Dec 4, 2014 at 11:35 AM, 'Terry Brown' via leo-editor 
leo-editor@googlegroups.com wrote:

Unless I'm missing something, that's what @path nodes are supposed to
 do.  If you created a @edit file.txt under the @path node, the text
 directory would be created for saving file.txt in.

 http://leoeditor.com/directives.html


​This is a programming mistake by the OP.  c.fileName produces::

   bound method Commands.fileName of Commander
   139748683191376: u'/path/to/your/outline.leo'

which just happens to end in a something that kinda looks like a path, but
also contains cruft that could, and probably will, confuse
g.os_path_abspath.

To repeat, instead of c.filename, the OP should use c.fileName().

EKR

-- 
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 leo-editor+unsubscr...@googlegroups.com.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at http://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.


Re: Strange g.os_path_abspath(c.fileName) behaviour...

2014-12-04 Thread Davy Cottet
Thank Edward, again you solve my problem :
So instead of g.os_path_abspath(c.fileName) that I was wrongly using since 
it kind of worked I have to use : g.os_path_dirname(c.fileName*()*)

I fact, I didn't understand what was this strange *c.fileName *comander 
followed by a string that *g.os_path_dirname *was kind of able to understand
*...*Thanks for your help

-- 
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 leo-editor+unsubscr...@googlegroups.com.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at http://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.