confuse-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Confuse-devel] search path


From: Martin Hedenfalk
Subject: Re: [Confuse-devel] search path
Date: Fri, 23 Apr 2010 09:15:50 +0200

Hi,

Instead of a global cfg_path, how about setting the include paths as a member 
of the cfg_t struct?

cfg_t *cfg = cfg_init(opt, flags);
cfg_set_include_paths(cfg, paths);
or
cfg_add_include_path(cfg, path);

then simply call cfg_parse as before, with your modifications to the lexer.

        -martin

21 apr 2010 kl. 12.01 skrev J.J. Green:

> Hi all
> 
> I've been using libconfuse for a while, but 
> have only just tried the "include" facility.  
> To my disappointment, I find that included 
> files are not found if they are not in the 
> current directory, or a full path is given.  
> I think this makes file inclusion barely useful.
> 
> A quick look at the code tells me that this would
> be fairly easy to implement without disturbing
> the API: For a null-terminated array of string
> 
> const char* path[] = { "/usr/local/share/myapp",
>                       "/usr/share/myapp",
>                       NULL };
> 
> int cfg_parse_path(cfg_t *cfg, 
>                   const char *filename,
>                   const char** path)
> 
> assigns path to global const char** cfg_path
> then checks for the existence of the files
> at path/filename (with stat() or access())
> and if found calls cfg_parse() with the found
> file.
> 
> cfg_lexer_include() is modified to check the
> global cfg_path and if not-null searches in 
> the same way.
> 
> Thoughts?
> 
> Would there be any interest in me adding this to
> the main code branch rather than just making my 
> own fork?
> 
> Cheers
> 
> Jim
> -- 
> J.J. Green,  Seaview Sensing Ltd., 
> http://seaviewsensing.com/
> 
> 
> 
> _______________________________________________
> Confuse-devel mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/confuse-devel





reply via email to

[Prev in Thread] Current Thread [Next in Thread]