Skip to content

Commit 8f0baab

Browse files
committed
Fix filenames changing when running LB after import
LaunchBox seems to have new rules for updating the names of files in the data directory, in particular Playlists, in which it attempts to change the filename to match the <Name> attribute name and then apply those rules to deal with illegal characters. This was causing icon names to be mismatched, meaning they wouldn't show in LaunchBox, and playlist names to not match on future imports, such that FIL didn't know they were the same playlist. Better kosherize filenames to try and match what LB would do so that it doesn't change them after FIL has touched them.
1 parent a62e670 commit 8f0baab

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

app/src/frontend/launchbox/lb-install.cpp

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -306,13 +306,26 @@ QString Install::translateDocName(const QString& originalName, Fe::DataDoc::Type
306306
{
307307
Q_UNUSED(type);
308308

309-
// Perform general kosherization
310-
QString translatedName = Qx::kosherizeFileName(originalName);
311-
312-
// LB specific changes
309+
/* LB has started doing something strange and annoying...
310+
* It appears it might be that it tries to override the filename of playlists with the
311+
* internal name (i.e. <Name> within the file), and then applies its own substitution
312+
* rules to deal with illegal characters. As such, here we try to do what LB does to avoid
313+
* unintended filename changes after an import (since that will lead to mismatches for
314+
* icons and futurer imports).
315+
*
316+
* The replacements needed, and the order of them, will need to be determined on a case-by-case
317+
* basis as they come up.
318+
*/
319+
320+
QString translatedName = originalName;
321+
322+
// LB matched changes (LB might replace all illegal characters with underscores, but these are is known for sure)
323+
translatedName.replace(':','_');
313324
translatedName.replace('#','_');
314325
translatedName.replace('\'','_');
315-
translatedName.replace('-','_');
326+
327+
// General kosherization
328+
translatedName = Qx::kosherizeFileName(translatedName);
316329

317330
return translatedName;
318331
}

0 commit comments

Comments
 (0)