deprecate wxDos2UnixFilename, wxUnix2DosFilename, wxStripExtension, wxGetTempFileName, wxExpandPath, wxContractPath, wxRealPath, wxCopyAbsolutePath, wxSplitPath and provide deprecation description in the docs (for the documented functions) or directly in the header (for undocumented functions)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@57872 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Francesco Montorsi
2009-01-07 01:29:54 +00:00
parent 1a7bfacc8a
commit 47d281e6b7
4 changed files with 66 additions and 35 deletions

View File

@@ -543,41 +543,49 @@ WXDLLIMPEXP_BASE wxString wxFileNameFromPath(const wxString& path);
// Get directory // Get directory
WXDLLIMPEXP_BASE wxString wxPathOnly(const wxString& path); WXDLLIMPEXP_BASE wxString wxPathOnly(const wxString& path);
WXDLLIMPEXP_BASE void wxDos2UnixFilename(char *s); // all deprecated functions below are deprecated in favour of wxFileName's methods
WXDLLIMPEXP_BASE void wxDos2UnixFilename(wchar_t *s); #if WXWIN_COMPATIBILITY_2_8
WXDLLIMPEXP_BASE void wxUnix2DosFilename(char *s); wxDEPRECATED( WXDLLIMPEXP_BASE void wxDos2UnixFilename(char *s) );
WXDLLIMPEXP_BASE void wxUnix2DosFilename(wchar_t *s); wxDEPRECATED( WXDLLIMPEXP_BASE void wxDos2UnixFilename(wchar_t *s) );
wxDEPRECATED( WXDLLIMPEXP_BASE void wxUnix2DosFilename(char *s) );
wxDEPRECATED( WXDLLIMPEXP_BASE void wxUnix2DosFilename(wchar_t *s) );
// Strip the extension, in situ // Strip the extension, in situ
WXDLLIMPEXP_BASE void wxStripExtension(char *buffer); wxDEPRECATED( WXDLLIMPEXP_BASE void wxStripExtension(char *buffer) );
WXDLLIMPEXP_BASE void wxStripExtension(wchar_t *buffer); wxDEPRECATED( WXDLLIMPEXP_BASE void wxStripExtension(wchar_t *buffer) );
WXDLLIMPEXP_BASE void wxStripExtension(wxString& buffer); wxDEPRECATED( WXDLLIMPEXP_BASE void wxStripExtension(wxString& buffer) );
// DEPRECATED: construct a wxFileName, use ClearExt() and then GetFullPath()
// Get a temporary filename // Get a temporary filename
WXDLLIMPEXP_BASE wxChar* wxGetTempFileName(const wxString& prefix, wxChar *buf = (wxChar *) NULL); wxDEPRECATED( WXDLLIMPEXP_BASE wxChar* wxGetTempFileName(const wxString& prefix, wxChar *buf = (wxChar *) NULL) );
WXDLLIMPEXP_BASE bool wxGetTempFileName(const wxString& prefix, wxString& buf); wxDEPRECATED( WXDLLIMPEXP_BASE bool wxGetTempFileName(const wxString& prefix, wxString& buf) );
// Expand file name (~/ and ${OPENWINHOME}/ stuff) // Expand file name (~/ and ${OPENWINHOME}/ stuff)
WXDLLIMPEXP_BASE char* wxExpandPath(char *dest, const wxString& path); wxDEPRECATED( WXDLLIMPEXP_BASE char* wxExpandPath(char *dest, const wxString& path) );
WXDLLIMPEXP_BASE wchar_t* wxExpandPath(wchar_t *dest, const wxString& path); wxDEPRECATED( WXDLLIMPEXP_BASE wchar_t* wxExpandPath(wchar_t *dest, const wxString& path) );
// FIXME-UTF8: add some wxString version // DEPRECATED: use wxFileName::Normalize(wxPATH_NORM_ENV_VARS)
// Contract w.r.t environment (</usr/openwin/lib, OPENWHOME> -> ${OPENWINHOME}/lib) // Contract w.r.t environment (</usr/openwin/lib, OPENWHOME> -> ${OPENWINHOME}/lib)
// and make (if under the home tree) relative to home // and make (if under the home tree) relative to home
// [caller must copy-- volatile] // [caller must copy-- volatile]
wxDEPRECATED(
WXDLLIMPEXP_BASE wxChar* wxContractPath(const wxString& filename, WXDLLIMPEXP_BASE wxChar* wxContractPath(const wxString& filename,
const wxString& envname = wxEmptyString, const wxString& envname = wxEmptyString,
const wxString& user = wxEmptyString); const wxString& user = wxEmptyString) );
// DEPRECATED: use wxFileName::ReplaceEnvVariable and wxFileName::ReplaceHomeDir
// Destructive removal of /./ and /../ stuff // Destructive removal of /./ and /../ stuff
// FIXME-UTF8: deprecate these two (and similar) wxDEPRECATED( WXDLLIMPEXP_BASE char* wxRealPath(char *path) );
WXDLLIMPEXP_BASE char* wxRealPath(char *path); wxDEPRECATED( WXDLLIMPEXP_BASE wchar_t* wxRealPath(wchar_t *path) );
WXDLLIMPEXP_BASE wchar_t* wxRealPath(wchar_t *path); wxDEPRECATED( WXDLLIMPEXP_BASE wxString wxRealPath(const wxString& path) );
WXDLLIMPEXP_BASE wxString wxRealPath(const wxString& path); // DEPRECATED: use wxFileName::Normalize instead
// Allocate a copy of the full absolute path // Allocate a copy of the full absolute path
WXDLLIMPEXP_BASE wxChar* wxCopyAbsolutePath(const wxString& path); wxDEPRECATED( WXDLLIMPEXP_BASE wxChar* wxCopyAbsolutePath(const wxString& path) );
// DEPRECATED: use wxFileName::MakeAbsolute instead
#endif
// Get first file name matching given wild card. // Get first file name matching given wild card.
// Flags are reserved for future use. // Flags are reserved for future use.
@@ -708,12 +716,14 @@ inline bool wxIsPathSeparator(wxChar c)
// does the string ends with path separator? // does the string ends with path separator?
WXDLLIMPEXP_BASE bool wxEndsWithPathSeparator(const wxString& filename); WXDLLIMPEXP_BASE bool wxEndsWithPathSeparator(const wxString& filename);
#if WXWIN_COMPATIBILITY_2_8
// split the full path into path (including drive for DOS), name and extension // split the full path into path (including drive for DOS), name and extension
// (understands both '/' and '\\') // (understands both '/' and '\\')
WXDLLIMPEXP_BASE void wxSplitPath(const wxString& fileName, wxDEPRECATED( WXDLLIMPEXP_BASE void wxSplitPath(const wxString& fileName,
wxString *pstrPath, wxString *pstrPath,
wxString *pstrName, wxString *pstrName,
wxString *pstrExt); wxString *pstrExt) );
#endif
// find a file in a list of directories, returns false if not found // find a file in a list of directories, returns false if not found
WXDLLIMPEXP_BASE bool wxFindFileInPath(wxString *pStr, const wxString& szPath, const wxString& szFile); WXDLLIMPEXP_BASE bool wxFindFileInPath(wxString *pStr, const wxString& szPath, const wxString& szFile);

View File

@@ -177,16 +177,22 @@ int wxParseCommonDialogsFilter(const wxString& wildCard,
Converts a DOS to a Unix filename by replacing backslashes with forward Converts a DOS to a Unix filename by replacing backslashes with forward
slashes. slashes.
@deprecated
Construct a wxFileName with wxPATH_DOS and then use
wxFileName::GetFullPath(wxPATH_UNIX) instead.
@header{wx/filefn.h} @header{wx/filefn.h}
*/ */
void wxDos2UnixFilename(wxChar* s); void wxDos2UnixFilename(wxChar* s);
/** /**
@warning This function is deprecated, use wxFileName instead.
Converts a Unix to a DOS filename by replacing forward slashes with Converts a Unix to a DOS filename by replacing forward slashes with
backslashes. backslashes.
@deprecated
Construct a wxFileName with wxPATH_UNIX and then use
wxFileName::GetFullPath(wxPATH_DOS) instead.
@header{wx/filefn.h} @header{wx/filefn.h}
*/ */
void wxUnix2DosFilename(wxChar* s); void wxUnix2DosFilename(wxChar* s);
@@ -199,8 +205,8 @@ void wxUnix2DosFilename(wxChar* s);
bool wxDirExists(const wxString& dirname); bool wxDirExists(const wxString& dirname);
/** /**
@warning This function is obsolete, please use wxFileName::SplitPath() @deprecated
instead. This function is obsolete, please use wxFileName::SplitPath() instead.
This function splits a full file name into components: the path (including This function splits a full file name into components: the path (including
possible disk/drive specification under Windows), the base name, and the possible disk/drive specification under Windows), the base name, and the
@@ -283,7 +289,7 @@ bool wxMatchWild(const wxString& pattern,
bool dot_special); bool dot_special);
/** /**
@warning This function is deprecated, use wxGetCwd() instead. @deprecated This function is deprecated, use wxGetCwd() instead.
Copies the current working directory into the buffer if supplied, or copies Copies the current working directory into the buffer if supplied, or copies
the working directory into new storage (which you must delete yourself) if the working directory into new storage (which you must delete yourself) if
@@ -446,8 +452,8 @@ wxFileKind wxGetFileKind(FILE* fp);
/** @addtogroup group_funcmacro_file */ /** @addtogroup group_funcmacro_file */
//@{ //@{
/** /**
@warning This function is obsolete, please use wxFileName::SplitPath() @deprecated
instead. This function is obsolete, please use wxFileName::SplitPath() instead.
Returns the filename for a full path. The second form returns a pointer to Returns the filename for a full path. The second form returns a pointer to
temporary storage that should not be deallocated. temporary storage that should not be deallocated.
@@ -461,8 +467,8 @@ char* wxFileNameFromPath(char* path);
/** @addtogroup group_funcmacro_file */ /** @addtogroup group_funcmacro_file */
//@{ //@{
/** /**
@warning This function is obsolete, please use @deprecated
wxFileName::CreateTempFileName() instead. This function is obsolete, please use wxFileName::CreateTempFileName() instead.
@header{wx/filefn.h} @header{wx/filefn.h}
*/ */

View File

@@ -112,7 +112,7 @@ wxWindow *wxFindSuitableParent()
wxString FindExtension(const wxString& path) wxString FindExtension(const wxString& path)
{ {
wxString ext; wxString ext;
wxSplitPath(path, NULL, NULL, &ext); wxFileName::SplitPath(path, NULL, NULL, &ext);
// VZ: extensions are considered not case sensitive - is this really a good // VZ: extensions are considered not case sensitive - is this really a good
// idea? // idea?

View File

@@ -104,8 +104,9 @@
// private globals // private globals
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// MT-FIXME: get rid of this horror and all code using it #if WXWIN_COMPATIBILITY_2_8
static wxChar wxFileFunctionsBuffer[4*_MAXPATHLEN]; static wxChar wxFileFunctionsBuffer[4*_MAXPATHLEN];
#endif
#if defined(__VISAGECPP__) && __IBMCPP__ >= 400 #if defined(__VISAGECPP__) && __IBMCPP__ >= 400
// //
@@ -360,6 +361,7 @@ wxIsAbsolutePath (const wxString& filename)
return false ; return false ;
} }
#if WXWIN_COMPATIBILITY_2_8
/* /*
* Strip off any extension (dot something) from end of file, * Strip off any extension (dot something) from end of file,
* IF one exists. Inserts zero into buffer. * IF one exists. Inserts zero into buffer.
@@ -755,6 +757,8 @@ wxContractPath (const wxString& filename,
return dest; return dest;
} }
#endif // #if WXWIN_COMPATIBILITY_2_8
// Return just the filename, not the path (basename) // Return just the filename, not the path (basename)
wxChar *wxFileNameFromPath (wxChar *path) wxChar *wxFileNameFromPath (wxChar *path)
{ {
@@ -949,13 +953,16 @@ void wxMacFilename2FSSpec( const wxString& path , FSSpec *spec )
OSStatus err = noErr; OSStatus err = noErr;
FSRef fsRef; FSRef fsRef;
wxMacPathToFSRef( path , &fsRef ); wxMacPathToFSRef( path , &fsRef );
err = FSGetCatalogInfo(&fsRef, kFSCatInfoNone, NULL, NULL, spec, NULL); err = FSGetCatalogInfo(&fsRef, kFSCatInfoNone, NULL, NULL, spec, NULL);
verify_noerr( err ); verify_noerr( err );
} }
#endif #endif
#endif // __WXMAC__ #endif // __WXMAC__
#if WXWIN_COMPATIBILITY_2_8
template<typename T> template<typename T>
static void wxDoDos2UnixFilename(T *s) static void wxDoDos2UnixFilename(T *s)
{ {
@@ -998,6 +1005,8 @@ wxDoUnix2DosFilename(T *WXUNUSED(s) )
void wxUnix2DosFilename(char *s) { wxDoUnix2DosFilename(s); } void wxUnix2DosFilename(char *s) { wxDoUnix2DosFilename(s); }
void wxUnix2DosFilename(wchar_t *s) { wxDoUnix2DosFilename(s); } void wxUnix2DosFilename(wchar_t *s) { wxDoUnix2DosFilename(s); }
#endif // #if WXWIN_COMPATIBILITY_2_8
// Concatenate two files to form third // Concatenate two files to form third
bool bool
wxConcatFiles (const wxString& file1, const wxString& file2, const wxString& file3) wxConcatFiles (const wxString& file1, const wxString& file2, const wxString& file3)
@@ -1365,6 +1374,8 @@ bool wxDirExists(const wxString& pathName)
#endif // __WIN32__/!__WIN32__ #endif // __WIN32__/!__WIN32__
} }
#if WXWIN_COMPATIBILITY_2_8
// Get a temporary filename, opening and closing the file. // Get a temporary filename, opening and closing the file.
wxChar *wxGetTempFileName(const wxString& prefix, wxChar *buf) wxChar *wxGetTempFileName(const wxString& prefix, wxChar *buf)
{ {
@@ -1399,6 +1410,8 @@ bool wxGetTempFileName(const wxString& prefix, wxString& buf)
#endif // wxUSE_FILE/!wxUSE_FILE #endif // wxUSE_FILE/!wxUSE_FILE
} }
#endif // #if WXWIN_COMPATIBILITY_2_8
// Get first file name matching given wild card. // Get first file name matching given wild card.
static wxDir *gs_dir = NULL; static wxDir *gs_dir = NULL;
@@ -1406,7 +1419,7 @@ static wxString gs_dirPath;
wxString wxFindFirstFile(const wxString& spec, int flags) wxString wxFindFirstFile(const wxString& spec, int flags)
{ {
wxSplitPath(spec, &gs_dirPath, NULL, NULL); wxFileName::SplitPath(spec, &gs_dirPath, NULL, NULL);
if ( gs_dirPath.empty() ) if ( gs_dirPath.empty() )
gs_dirPath = wxT("."); gs_dirPath = wxT(".");
if ( !wxEndsWithPathSeparator(gs_dirPath ) ) if ( !wxEndsWithPathSeparator(gs_dirPath ) )
@@ -1705,6 +1718,7 @@ bool wxFindFileInPath(wxString *pStr, const wxString& szPath, const wxString& sz
return false; return false;
} }
#if WXWIN_COMPATIBILITY_2_8
void WXDLLIMPEXP_BASE wxSplitPath(const wxString& fileName, void WXDLLIMPEXP_BASE wxSplitPath(const wxString& fileName,
wxString *pstrPath, wxString *pstrPath,
wxString *pstrName, wxString *pstrName,
@@ -1712,6 +1726,7 @@ void WXDLLIMPEXP_BASE wxSplitPath(const wxString& fileName,
{ {
wxFileName::SplitPath(fileName, pstrPath, pstrName, pstrExt); wxFileName::SplitPath(fileName, pstrPath, pstrName, pstrExt);
} }
#endif // #if WXWIN_COMPATIBILITY_2_8
#if wxUSE_DATETIME #if wxUSE_DATETIME