[AD] Relative paths in the grabber |
[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]
Ok, due to some unexpected free time and interest in this over at Allegro.cc, I've updated the changes I made to the grabber almost a year ago to create relative rather than absolute paths to 4.1.9. The attached patch does the following: it adds a `use relative paths' option to the options menu that, when checked, causes the grabber to store the relative path to items in the datafile. Existing items are not affected. There are also two new options in the item options box: one to convert paths to relative and one to convert to absolute. These work on mutiple selections as well. I've been using the code in more or less this form for a while and it seems to work fine, however, there are a few things that bother me: - the mechanism used to construct relative paths from absolute paths. Although it works, I'd like a second opinion on the code. - because the point (for me) of adding relative paths is easy compatibility between DOS/Windows and Linux, absolute paths use the / path seperator consistently. This is conterary to the standard Allegro practice, where \ is used by default on DOS/Windows. I've had to introduce a char *fix_filename_forward_slashes(char *filename) that converts all \ path seperators to /. I don't think it's particularly elegant and I feel it's out of place in the grabber. I'm not sure where else to put it, though... (or maybe there is already an Allegro internal symbol that does something similar? Are internal functions documented anywhere beside the source?) In order to test the code more thoroughly, I've considered putting it up for testing on Allegro.cc. Any objections?
Attachment:
grabber_relative_paths.diff.gz
Description: GNU Zip compressed data
Mail converted by MHonArc 2.6.19+ | http://listengine.tuxfamily.org/ |