Return false from wxFileName::AppendDir() and InsertDir() on failure.

Give the caller a way to know whether the directory was valid or not.

Closes #15091.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73631 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2013-03-09 15:08:36 +00:00
parent 29cc4cc9bc
commit 6aa4e3989f
3 changed files with 31 additions and 16 deletions

View File

@@ -2034,10 +2034,12 @@ wxFileName::IsMSWUniqueVolumeNamePath(const wxString& path, wxPathFormat format)
return true;
}
void wxFileName::AppendDir( const wxString& dir )
bool wxFileName::AppendDir( const wxString& dir )
{
if ( IsValidDirComponent(dir) )
m_dirs.Add( dir );
if (!IsValidDirComponent(dir))
return false;
m_dirs.Add(dir);
return true;
}
void wxFileName::PrependDir( const wxString& dir )
@@ -2045,10 +2047,12 @@ void wxFileName::PrependDir( const wxString& dir )
InsertDir(0, dir);
}
void wxFileName::InsertDir(size_t before, const wxString& dir)
bool wxFileName::InsertDir(size_t before, const wxString& dir)
{
if ( IsValidDirComponent(dir) )
m_dirs.Insert(dir, before);
if (!IsValidDirComponent(dir))
return false;
m_dirs.Insert(dir, before);
return true;
}
void wxFileName::RemoveDir(size_t pos)