AO2-Client icon indicating copy to clipboard operation
AO2-Client copied to clipboard

Content, where art thou? - Limit path lookups and remove "panic" lookups

Open Salanto opened this issue 3 years ago • 0 comments

AO's pathing has always been terrible. There is no reason to even remotely deny it, but the introduction of more complex asset systems has revealed how unwieldy the system has become.

How can we approach this? First, AO needs to decide where content belongs and stop its extreme lookups, which rival crack addicts trying to find their next fix. A function definition like this should tell you how bad the current system is : QVector<VPath> AOApplication::get_asset_paths(QString p_element, QString p_theme, QString p_subtheme, QString p_default_theme, QString p_misc, QString p_character, QString p_placeholder)

A solution would be to :

  • Remove ambiguity on what content is being requested in a file lookup. Simple dummy datatypes could work well.
  • Group lookups by type and use specific functions, i.E get_backgroundFile(QString) can access a specific background or a shared overlay folder.
  • Limit cross-folder traversal to content outside the lookup path. i.E delete folder traversal. Sorry, it sucks. If you need to use ../ to access your content, please kindly sit down and ponder over your life as you clearly lost control of it.
  • Remove the reliance on AOApplication.
  • Seriously, everyone and their mom include that header and most objects look like: AOSomeObject(ao_app, some_other_crap); because they do some path lookups.

If these goals are met, we might be able to get a grip on AO's content.

Will this break some old content? Probably. Do I care too much about it? Not in the slightest.

Salanto avatar Aug 04 '22 21:08 Salanto