CnCNet / xna-cncnet-client

XNA / MonoGame based client for playing classic Command & Conquer games both online and offline with a CnCNet game spawner.
Other
226 stars 87 forks source link

Update Rampastring.Tools to fix crashes on empty theme folder #393

Closed SadPencil closed 1 year ago

SadPencil commented 1 year ago

In file Startup.cs:

            string themePath = ClientConfiguration.Instance.GetThemePath(UserINISettings.Instance.ClientTheme);

            if (themePath == null)
            {
                themePath = ClientConfiguration.Instance.GetThemeInfoFromIndex(0)[1];
            }

            ProgramConstants.RESOURCES_DIR = SafePath.CombineDirectoryPath(ProgramConstants.BASE_RESOURCE_PATH, themePath);

themePath could be string.Empty. (e.g. Mental Omega) And old version of Rampastring.Tools will mistakenly return "\\" as the combined dir path to ProgramConstants.RESOURCES_DIR, which has been fixed by https://github.com/Rampastring/Rampastring.Tools/pull/7

And this PR upgrades the dependency to solve this bug.


P.S. I don't know why the dependency of Rampastring.Tools only appears in Localization project and upgrading it fixes the issue. Why other four projects does not explicitly depends on it while being able to call its methods?

github-actions[bot] commented 1 year ago

Nightly build for this pull request:

SadPencil commented 1 year ago

@Rans4ckeR Do you have ideas on this?

Rans4ckeR commented 1 year ago

P.S. I don't know why the dependency of Rampastring.Tools only appears in Localization project and upgrading it fixes the issue. Why other four projects does not explicitly depends on it while being able to call its methods?

This is due to the 'new' project file format and PackageReference which uses transitive dependencies.

image