From 07ab48032d24a553dac38b1ac9a84eeabed96d6b Mon Sep 17 00:00:00 2001 From: David Rose Date: Fri, 26 Jul 2002 23:40:59 +0000 Subject: [PATCH] support image filenames with embedded dots --- pandatool/src/egg-palettize/imageFile.cxx | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/pandatool/src/egg-palettize/imageFile.cxx b/pandatool/src/egg-palettize/imageFile.cxx index 804649931d..54f86b702f 100644 --- a/pandatool/src/egg-palettize/imageFile.cxx +++ b/pandatool/src/egg-palettize/imageFile.cxx @@ -193,15 +193,19 @@ void ImageFile:: set_filename(const string &dirname, const string &basename) { _filename = Filename(dirname, basename); - if (_properties._color_type != (PNMFileType *)NULL) { - _filename.set_extension - (_properties._color_type->get_suggested_extension()); + if (_properties._alpha_type != (PNMFileType *)NULL) { + _alpha_filename = + _filename.get_fullpath() + "_a." + + _properties._alpha_type->get_suggested_extension(); } - if (_properties._alpha_type != (PNMFileType *)NULL) { - _alpha_filename = _filename.get_fullpath_wo_extension() + "_a"; - _alpha_filename.set_extension - (_properties._alpha_type->get_suggested_extension()); + if (_properties._color_type != (PNMFileType *)NULL) { + // We shouldn't use _filename.set_extension(), because that may + // inadvertently truncate the filename if it already includes a + // dot. + _filename = + _filename.get_fullpath() + "." + + _properties._color_type->get_suggested_extension(); } }