Dynamically adding reports

Derek Atkins warlord at MIT.EDU
Thu Jun 11 16:47:30 EDT 2009


Havard,

Quoting Havard Rast Blok <nn2 at hblok.net>:

> This sounds like a useful improvement.
>
> I have a minor comment, which might be a tangent: When using the 
> ~/.gnucash/config.user to specify "load-from-path" reports, it will 
> not work unless the absolute path is specified; e.g. 
> "/home/user/.gnucash/reports/myreport.scm". If I use "~/.gnucash/..." 
> the report will not load.

This is correct..  That's because load-file-path requires a full path.
It doesn't perform any variable expansion, and '~' is shell syntax.
So this isn't at all surprising.

There may be a guile function to expand the path but I don't know what
it may be offhand.

Regardless, this is completely unrelated to Phil's sugggestion and
should not have been a reply to his message.

Thanks,

> Regards,
> Havard

-derek

> Phil Longstaff wrote:
>> I played around last night with how reports are loaded in the 
>> system.  I basically replaced:
>>
>> (use-module (gnucash report report-A))
>> (use-module (gnucash report report-B))
>>
>> which appears in standard-reports.scm, with
>>
>> (define (get-report-list) (list
>>     'report-A
>>     'report-B
>> ))
>> (for-each (lambda (x) (resolve-module (append '(gnucash report) x))) 
>> (get-report-list))
>>
>> which does nothing new, but does allow me to replace 
>> (get-report-list) with a function which returns the names of all 
>> .scm files.  This will then allow a user/developer to just drop a 
>> new report file into the reports directory, restart gnucash, and it 
>> will be picked up.  Or, (get-report-list) could read the list of 
>> report file names from a standard-report-names.txt file, which would 
>> allow the user/developer to drop a report file into the reports 
>> directory, add the file name to the standard-report-names.txt, then 
>> restart.  My preference is for the former (fewer steps), but a 
>> little more difficult.
>>
>> The reports directory currently holds all of the report files (both 
>> standard and business) as well as some support files.  I think what 
>> I will do is create a 'standard-reports' subdirectory to the reports 
>> directory, and put the standard reports (or symlinks) there.  
>> get-report-list will then have a single directory from which to get 
>> all of the file names.
>>
>> Comments?
>>
>> Phil
>> _______________________________________________
>> gnucash-devel mailing list
>> gnucash-devel at gnucash.org
>> https://lists.gnucash.org/mailman/listinfo/gnucash-devel
>>
> _______________________________________________
> gnucash-devel mailing list
> gnucash-devel at gnucash.org
> https://lists.gnucash.org/mailman/listinfo/gnucash-devel
>



-- 
       Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory
       Member, MIT Student Information Processing Board  (SIPB)
       URL: http://web.mit.edu/warlord/    PP-ASEL-IA     N1NWH
       warlord at MIT.EDU                        PGP key available



More information about the gnucash-devel mailing list