In a scenario where foo and x-foo both exist, it was previously
possible for foo to be moved to x-foo before x-foo had been moved
to x-x-foo, with the result that the original x-foo went missing
having been overwritten.
By reverse sorting base names by length, we ensure that x-foo will
always be renamed before foo, avoiding the potential for overwriting
such shadowed assets.
In a scenario where
foo
andx-foo
both exist, it was previously possible forfoo
to be moved tox-foo
beforex-foo
had been moved tox-x-foo
, with the result that the originalx-foo
went missing having been overwritten.By reverse sorting base names by length, we ensure that
x-foo
will always be renamed beforefoo
, avoiding the potential for overwriting such shadowed assets.Fixes: https://github.com/renpy/renpy/issues/3902