diff --git a/docs/changes.txt b/docs/changes.txt index 3711434954..c4a73d2224 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -185,6 +185,7 @@ All: - fixed duplicate wxFontEncoding values - wxFileConfig now always uses UTF-8 to store settings in Unicode build; it will be possible to set different charset in wxWindows >= 2.5.0 +- added wxFileName::MakeAbsolute Unix (GUI): diff --git a/docs/latex/wx/filename.tex b/docs/latex/wx/filename.tex index 1749fbdcfb..dd1b882482 100644 --- a/docs/latex/wx/filename.tex +++ b/docs/latex/wx/filename.tex @@ -87,10 +87,10 @@ File names can be case-sensitive or not, the function\rtfsp The rules for determining if the file name is absolute or relative also depends on the file name format and the only portable way to answer to this question is to use \helpref{IsAbsolute}{wxfilenameisabsolute} method. To ensure that the -filename is absolute you may use \helpref{Normalize}{wxfilenamenormalize}. There -is also an inverse function \helpref{MakeRelativeTo}{wxfilenamemakerelativeto} -which undoes what \helpref{Normalize(wxPATH\_NORM\_DOTS)}{wxfilenamenormalize} -does. +filename is absolute you may use +\helpref{MakeAbsolute}{wxfilenamemakeabsolute}. There is also an inverse +function \helpref{MakeRelativeTo}{wxfilenamemakerelativeto} which undoes what +\helpref{Normalize(wxPATH\_NORM\_DOTS)}{wxfilenamenormalize} does. Other functions returning information about the file format provided by this class are \helpref{GetVolumeSeparator}{wxfilenamegetvolumeseparator},\rtfsp @@ -525,6 +525,23 @@ directory or file really exists, you should use \helpref{DirExists}{wxfilenamedirexists} or \helpref{FileExists}{wxfilenamefileexists} for this. +\membersection{wxFileName::MakeAbsolute}\label{wxfilenamemakeabsolute} + +\func{bool}{MakeAbsolute}{\param{const wxString\& }{cwd = wxEmptyString}, \param{wxPathFormat }{format = wxPATH\_NATIVE}} + +Make the file name absolute. This is a shortcut for +{\tt \helpref{Normalize}{wxfilenamenormalize}(wxPATH\_NORM\_DOTS | wxPATH\_NORM\_ABSOLUTE | wxPATH\_NORM\_TILDE, cwd, format)}. + +\wxheading{See also} + +\helpref{MakeRelativeTo}{wxfilenamemakerelativeto}, +\helpref{Normalize}{wxfilenamenormalize}, +\helpref{IsAbsolute}{wxfilenameisabsolute} + +\wxheading{Note} + +This method was added in wxWindows 2.4.1. + \membersection{wxFileName::MakeRelativeTo}\label{wxfilenamemakerelativeto} \func{bool}{MakeRelativeTo}{\param{const wxString\& }{pathBase = ""}, \param{wxPathFormat }{format = wxPATH\_NATIVE}} diff --git a/include/wx/filename.h b/include/wx/filename.h index 38e6645e06..edd5307856 100644 --- a/include/wx/filename.h +++ b/include/wx/filename.h @@ -271,6 +271,10 @@ public: bool MakeRelativeTo(const wxString& pathBase = _T(""), wxPathFormat format = wxPATH_NATIVE); + bool MakeAbsolute(const wxString& cwd = wxEmptyString, + wxPathFormat format = wxPATH_NATIVE) + { return Normalize(wxPATH_NORM_DOTS | wxPATH_NORM_ABSOLUTE | + wxPATH_NORM_TILDE, cwd, format); } // Comparison