Thursday, June 24, 2010

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

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".
>
>
> Could someone verify the intended behaviour?
>
> TIA,
> Dave

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'

This is the output of my :version

VIM - Vi IMproved 7.2 (2008 Aug 9, compiled Jun 24 2010 10:17:24)
Included patches: 1-444
Compiled by fadein@gemini
Normal version with GTK2 GUI. Features included (+) or not (-):
-arabic +autocmd +balloon_eval +browse +builtin_terms +byte_offset +cindent
+clientserver +clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments
+cryptv -cscope +cursorshape +dialog_con_gui +diff +digraphs +dnd -ebcdic
-emacs_tags +eval +ex_extra +extra_search -farsi +file_in_path +find_in_path
+float +folding -footer +fork() +gettext -hangul_input +iconv +insert_expand
+jumplist -keymap -langmap +libcall +linebreak +lispindent +listcmds +localmap
+menu +mksession +modify_fname +mouse +mouseshape -mouse_dec +mouse_gpm
-mouse_jsbterm -mouse_netterm -mouse_sysmouse +mouse_xterm +multi_byte
+multi_lang -mzscheme +netbeans_intg -osfiletype +path_extra +perl +postscript
+printer -profile +python +quickfix +reltime -rightleft -ruby +scrollbind
+signs +smartindent -sniff +startuptime +statusline -sun_workshop +syntax
+tag_binary +tag_old_static -tag_any_white -tcl +terminfo +termresponse
+textobjects +title +toolbar +user_commands +vertsplit +virtualedit +visual
+visualextra +viminfo +vreplace +wildignore +wildmenu +windows +writebackup
+X11 -xfontset +xim +xsmp_interact +xterm_clipboard -xterm_save
system vimrc file: "$VIM/vimrc"
user vimrc file: "$HOME/.vimrc"
user exrc file: "$HOME/.exrc"
system gvimrc file: "$VIM/gvimrc"
user gvimrc file: "$HOME/.gvimrc"
system menu file: "$VIMRUNTIME/menu.vim"
fall-back for $VIM: "/usr/local/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK -I/usr/include/g
tk-2.0 -I/usr/lib64/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo
-I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -
I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12 -g -
O2 -D_FORTIFY_SOURCE=1 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/lib
64/perl5/5.8.8/x86_64-linux/CORE -I/usr/include/python2.6 -pthread
Linking: gcc -rdynamic -L/usr/local/lib -o vim -lgtk-x11-2.0 -lgdk-x11-2.0
-latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lgdk_pixbuf-2.0 -lpangocairo-1.0 -lcairo -l
pango-1.0 -lfreetype -lfontconfig -lgobject-2.0 -lgmodule-2.0 -lglib-2.0 -lXt
-lncurses -lacl -lgpm -rdynamic -L/usr/local/lib64 /usr/lib64/perl5/5.8.8/x86
_64-linux/auto/DynaLoader/DynaLoader.a -L/usr/lib64/perl5/5.8.8/x86_64-linux/COR
E -lperl -lutil -lc -L/usr/lib/python2.6/config -lpython2.6 -lutil -lm -Xlinker
-export-dynamic

--
Erik Falor
Registered Linux User #445632 http://counter.li.org

No comments: