X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/967a322fe965bd511d0d45cec336047c36ea39b9..399b60a0ad232265cd74ce8bf6a53a1f2cc57ff2:/src/common/textfile.cpp diff --git a/src/common/textfile.cpp b/src/common/textfile.cpp index f10d5de576..89a8e94033 100644 --- a/src/common/textfile.cpp +++ b/src/common/textfile.cpp @@ -159,6 +159,32 @@ bool wxTextFile::Exists() const return wxFile::Exists(m_strFile); } +bool wxTextFile::Create(const wxString& strFile) +{ + m_strFile = strFile; + + return Create(); +} + +bool wxTextFile::Create() +{ + // file name must be either given in ctor or in Create(const wxString&) + wxASSERT( !m_strFile.IsEmpty() ); + + // if the file already exists do nothing + if ( Exists() ) return FALSE; + + if ( m_file.Open(m_strFile, wxFile::write) ) + { + m_file.Close(); + return TRUE; + } + else + { + return FALSE; + } +} + bool wxTextFile::Open(const wxString& strFile) { m_strFile = strFile;