issue 3598 and 2289 - util functions to determine file types by ending
This commit is contained in:
@@ -2377,7 +2377,7 @@ bool Options::has_retained_extention (Glib::ustring fname)
|
||||
bool Options::is_extention_enabled (Glib::ustring ext)
|
||||
{
|
||||
for (int j = 0; j < (int)parseExtensions.size(); j++)
|
||||
if (parseExtensions[j].casefold() == ext.casefold()) {
|
||||
if (parseExtensions[j].casefold() == ext.casefold()) { // issue 3598 REVIEW OK - no change required
|
||||
return j >= (int)parseExtensionsEnabled.size() || parseExtensionsEnabled[j];
|
||||
}
|
||||
|
||||
|
||||
@@ -277,13 +277,14 @@ const ProfileStoreEntry* ProfileStore::findEntryFromFullPathU(Glib::ustring path
|
||||
if (path == DEFPROFILE_INTERNAL) {
|
||||
return internalDefaultEntry;
|
||||
}
|
||||
// consistently apply casefold() to make sure dot position is correct
|
||||
const Glib::ustring::size_type lastdot = path.casefold().find_last_of ('.');
|
||||
|
||||
size_t lastdot = path.find_last_of ('.');
|
||||
|
||||
if (lastdot != Glib::ustring::npos && lastdot <= path.size() - 4 && !path.casefold().compare (lastdot, 4, paramFileExtension))
|
||||
if ((lastdot != Glib::ustring::npos) && (lastdot <= path.casefold().size() - 4) && (!path.casefold().compare (lastdot, 4, paramFileExtension)))
|
||||
// removing the extension
|
||||
{
|
||||
path = path.substr(0, lastdot);
|
||||
// now use dot position without casefold()
|
||||
path = path.substr(0, path.find_last_of ('.'));
|
||||
}
|
||||
|
||||
// dir separator may come from options file and may be \ or /, we convert them to G_DIR_SEPARATOR_S
|
||||
|
||||
Reference in New Issue
Block a user