Re: [AD] file.c # patch

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


Evert Glebbeek wrote:
What do you mean? I have code in place that loads "midi.dat#midifile.mid", where midifile.mid is the name of some object in the datafile. As far as I know, this is well documented...?
Or is that not what you meant?

No, that's not what I meant. What I meant is, according to the code, if you called replace_filename with that file, it would replace only the midifile.mid portion, not midi.dat. Also, if you had "midi.dat#midi1" and called replace_extension, or something of the like, it would treat midi1 as an extension. The docs make no mention of this behavior.

I've only taken a very quick glance at your code. In what order does it try to load a file? Datafile element first or regular file first?

Datafile first, then regular file. Not that I think many people would have a file called 'datafile.dat#objectname.ext' along with a 'datafile.dat' containing 'objectname.ext' in the same directory..

However, there is/was some ambiguity as to what to do with filename strings (for the get/replace filename/extension/path functions), where the file may or may not exist. I opted to always treat it as a normal file, since the docs make no mention of special behavior with datafile#objectname filenames and it was the only way I could do it to make those functions properly handle files with # (since again, the filename you're passing to those functions may or may not exist.. there's no way to know what the user meant).

- Kitty Cat




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/