Loading ...
Sorry, an error occurred while loading the content.

Re: findfile() behaviour difference to finddir() - no path information

Expand Messages
  • David Fishburn
    ... In this case, I was several levels deep but this file was also within the same directory. So what was returned was a relative filename. I have written my
    Message 1 of 4 , Jun 25, 2010
    • 0 Attachment
      On 24/06/2010 1:06 PM, Erik Falor wrote:
      On Thu, Jun 24, 2010 at 09:49:26AM -0400, David Fishburn wrote:
        
      VIM - Vi IMproved 7.2 (2008 Aug 9, compiled Jun 22 2010 14:52:33)
      MS-Windows 32-bit GUI version with OLE support
      Included patches: 1-444
      
      When I issue a finddir(), I get an absolute path back to the
      location of my file (in my particular case).
      
      When I issue a findfile(), I get just the file, which is kind of
      useless since I want to edit the file.  This only tells me it found
      it, not where it found it.
      
      Looking at :h finddir()
      
              Returns the path of the first found match.  When the found
              directory is below the current directory a relative path is
              returned.  Otherwise a full path is returned.
      
      
      :h findfile()
              Just like |finddir()|, but find a file instead of a directory.
      
      So I should be receiving either a relative path name or a fullpath.
      Given the finddir() returned the fullpath in this case, findfile()
      should also.
      In my case, I received just the filename even though the file was
      several directories deep from the initial path to search from.
      finddir() did the "right thing".
      
      
      ...
      I followed these steps, and did not reproduce your Vim's behavior:
      
      1. Create file ~/test/b/bb/bbb/b.file
      2. `vim -u NONE -c 'chdir ~/test'`
      3. :echo findfile('b.file', './**')
         Results in 'b/bb/bbb/b.file'
      4. :echo finddir('bbb', './**')
         Results in 'b/bb/bbb'
        

      In this case, I was several levels deep but this file was also within the same directory.  So what was returned was a relative filename.

      I have written my own function for includeexpr, and since a file without a path was returned it failed to open it.  So now I detect this case and add the current local directory.

      Thanks,
      Dave

      --
      You received this message from the "vim_use" maillist.
      Do not top-post! Type your reply below the text you are replying to.
      For more information, visit http://www.vim.org/maillist.php
    Your message has been successfully submitted and would be delivered to recipients shortly.