Fix wxFileName::ReplaceHomeDir() when HOME=="/"
This is rare but can happen and the function behaved completely wrongly in this case, so handle it explicitly. Also disable the unit test when HOME has this value, as it assumes this is not the case.
This commit is contained in:
parent
231c079c70
commit
96a917eaa8
2 changed files with 15 additions and 1 deletions
|
|
@ -466,7 +466,16 @@ TEST_CASE("wxFileName::Replace", "[filename]")
|
|||
|
||||
// now test ReplaceHomeDir
|
||||
|
||||
wxFileName fn = wxFileName::DirName(wxGetHomeDir());
|
||||
const wxString& homedir = wxGetHomeDir();
|
||||
if ( homedir == "/" )
|
||||
{
|
||||
// These tests assume that HOME is a non-root directory, but this may
|
||||
// not be the case.
|
||||
WARN("Skipping wxFileName::ReplaceHomeDir() tests because HOME=/");
|
||||
return;
|
||||
}
|
||||
|
||||
wxFileName fn = wxFileName::DirName(homedir);
|
||||
fn.AppendDir("test1");
|
||||
fn.AppendDir("test2");
|
||||
fn.AppendDir("test3");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue