Deprecate wxPATH_NORM_ALL and Normalize() with default flags

Using wxFileName::Normalize() with default flags could be surprising and
result in bugs in the code, as shown by our own wrong use of it in
wxFileSystemWatcher corrected in the previous commit.

Deprecate using it without any flags and recommend using MakeAbsolute()
instead.

Also improve the related parts of the documentation.
This commit is contained in:
Vadim Zeitlin
2021-07-11 14:23:40 +01:00
parent 2cd7025d7b
commit 702c221901
4 changed files with 77 additions and 14 deletions

View File

@@ -36,6 +36,10 @@
#include "testfile.h"
#include "testdate.h"
// Use a hack to keep using wxPATH_NORM_ALL in this test code without getting
// deprecation warnings for it.
#define wxPATH_NORM_ALL wxPATH_NORM_DEPR_OLD_DEFAULT
// ----------------------------------------------------------------------------
// test data
// ----------------------------------------------------------------------------
@@ -317,6 +321,13 @@ TEST_CASE("wxFileName::Normalize", "[filename]")
{ ".\\foo", wxPATH_NORM_LONG, ".\\foo", wxPATH_DOS },
{ "..\\Makefile.in", wxPATH_NORM_LONG, "..\\Makefile.in", wxPATH_DOS },
{ "..\\foo", wxPATH_NORM_LONG, "..\\foo", wxPATH_DOS },
// test default behaviour with deprecated wxPATH_NORM_ALL
#ifdef __WINDOWS__
{ "%ABCDEF%/g/h/i", wxPATH_NORM_ALL, "CWD/abcdef/g/h/i", wxPATH_UNIX },
#else
{ "$(ABCDEF)/g/h/i", wxPATH_NORM_ALL, "CWD/abcdef/g/h/i", wxPATH_UNIX },
#endif
};
// set the env var ABCDEF