4coder»Forums
xel
18 posts
presses plastic buttons for fun
Getting directory of current buffer
Hello,

I'm working on my build system right now, and would like to modify the build_search function. build_search uses app->directory_get_hot to get the last visited directory in order to execute build.bat. However, I would like build_search to look in the directory of the file which is in the active view.

I've looked at the View_Summary and Buffer_Summary structures, but they don't seem to have some kind of "file_path" member. There also doesn't seem to be any functions in the documentation which might return the directory associated with a view or buffer.

Thanks Again.
Simon Anciaux
1120 posts
Getting directory of current buffer
Buffer_Summary.file_name contains the full path to the file (path + file name). You can find the Buffer_Summary struct definition in 4coder_custom.h.
xel
18 posts
presses plastic buttons for fun
Getting directory of current buffer
Whoops, missed that. Thanks.
Allen Webster
473 posts / 4 projects
Heyo
Getting directory of current buffer
mrmixer
Buffer_Summary.file_name contains the full path to the file (path + file name). You can find the Buffer_Summary struct definition in 4coder_custom.h.


Man, you really know your 4coder stuff! Have you, by any chance, written some cool customizations?
Simon Anciaux
1120 posts
Getting directory of current buffer
Not really. I've just written a few functions I was used to work with in my previous editor (go to next error, find matching brace, comment range...).
The only "new" thing I've written is that 'tab' indents if the cursor is on a white space and auto complete if it's on a letter. I wanted that for quite some time and it's so easy to do in 4coder.

Simple things, but being able to program the editor so easily just feels great. Thanks !