// Dir accessors
size_t GetDirCount() const { return m_dirs.size(); }
- void AppendDir(const wxString& dir);
+ bool AppendDir(const wxString& dir);
void PrependDir(const wxString& dir);
- void InsertDir(size_t before, const wxString& dir);
+ bool InsertDir(size_t before, const wxString& dir);
void RemoveDir(size_t pos);
void RemoveLastDir() { RemoveDir(GetDirCount() - 1); }
wxPathFormat format = wxPATH_NATIVE);
/**
- Appends a directory component to the path. This component should contain a
- single directory name level, i.e. not contain any path or volume separators nor
- should it be empty, otherwise the function does nothing (and generates an
- assert failure in debug build).
+ Appends a directory component to the path.
+
+ This component should contain a single directory name level, i.e. not
+ contain any path or volume separators nor should it be empty, otherwise
+ the function does nothing and returns false (and generates an assert
+ failure in debug build).
+
+ Notice that the return value is only available in wxWidgets 2.9.5 or
+ later.
*/
- void AppendDir(const wxString& dir);
+ bool AppendDir(const wxString& dir);
/**
Creates the file name from another filename object.
bool HasVolume() const;
/**
- Inserts a directory component before the zero-based position in the directory
- list. Please see AppendDir() for important notes.
+ Inserts a directory component before the zero-based position in the
+ directory list.
+
+ As with AppendDir(), @a dir must be a single directory name and the
+ function returns @false and does nothing else if it isn't.
+
+ Notice that the return value is only available in wxWidgets 2.9.5 or
+ later.
*/
- void InsertDir(size_t before, const wxString& dir);
+ bool InsertDir(size_t before, const wxString& dir);
/**
Returns @true if this filename is absolute.
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 )
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)