Re: [AD] al_path_set_extension |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
On 2009-02-13, Thomas Fjellstrom <tfjellstrom@xxxxxxxxxx> wrote:
> On February 13, 2009, Trent Gamblin wrote:
> > On Fri, February 13, 2009 6:00 pm, Peter Wang said:
> > > One way to resolve this is to define an extension to include the dot as
> > > well. Then:
> > >
> > > al_path_set_extension("abc", ".ext") ==> "abc.ext"
> > > al_path_set_extension("abc.ext", ".def") ==> "abc.def"
> > > al_path_set_extension("abc.def", "") ==> "abc"
> > >
> > > Then al_path_set_extension could be used to remove the extension. Also
> > > the first call doesn't magically grow a dot character out of nowhere.
> > > al_path_get_extension would return the leading dot.
> > >
> > > What do you think?
> >
> > Better than the current behaviour.
>
> So long as it makes sense, I don't much care.
>
Further path questions:
1. Is it important to allow NULL drive and filename components? Is
there any difference between a NULL drive/filename and a drive/filename
which is an empty string? It is easier for the implementation if we
don't use NULLs internally.
2. Can I change al_path_get_extension and al_path_get_basename to return
pointers to internally allocated memory, instead of filling a buffer
provided by the user? This is consistent with al_path_get_drive,
al_path_get_index, al_path_get_filename, and easier to use. It's only a
little bit of extra memory to copy the basename from the filename when
the user calls al_path_get_basename.
3. Similarly for al_path_to_string.
Peter