-// ----------------------------------------------------------------------------
-// wxFileName
-// ----------------------------------------------------------------------------
-
-#ifdef TEST_FILENAME
-
-#include "wx/filename.h"
-
-#if 0
-static void DumpFileName(const wxChar *desc, const wxFileName& fn)
-{
- wxPuts(desc);
-
- wxString full = fn.GetFullPath();
-
- wxString vol, path, name, ext;
- wxFileName::SplitPath(full, &vol, &path, &name, &ext);
-
- wxPrintf(wxT("'%s'-> vol '%s', path '%s', name '%s', ext '%s'\n"),
- full.c_str(), vol.c_str(), path.c_str(), name.c_str(), ext.c_str());
-
- wxFileName::SplitPath(full, &path, &name, &ext);
- wxPrintf(wxT("or\t\t-> path '%s', name '%s', ext '%s'\n"),
- path.c_str(), name.c_str(), ext.c_str());
-
- wxPrintf(wxT("path is also:\t'%s'\n"), fn.GetPath().c_str());
- wxPrintf(wxT("with volume: \t'%s'\n"),
- fn.GetPath(wxPATH_GET_VOLUME).c_str());
- wxPrintf(wxT("with separator:\t'%s'\n"),
- fn.GetPath(wxPATH_GET_SEPARATOR).c_str());
- wxPrintf(wxT("with both: \t'%s'\n"),
- fn.GetPath(wxPATH_GET_SEPARATOR | wxPATH_GET_VOLUME).c_str());
-
- wxPuts(wxT("The directories in the path are:"));
- wxArrayString dirs = fn.GetDirs();
- size_t count = dirs.GetCount();
- for ( size_t n = 0; n < count; n++ )
- {
- wxPrintf(wxT("\t%u: %s\n"), n, dirs[n].c_str());
- }
-}
-#endif
-
-static void TestFileNameTemp()
-{
- wxPuts(wxT("*** testing wxFileName temp file creation ***"));
-
- static const wxChar *tmpprefixes[] =
- {
- wxT(""),
- wxT("foo"),
- wxT(".."),
- wxT("../bar"),
-#ifdef __UNIX__
- wxT("/tmp/foo"),
- wxT("/tmp/foo/bar"), // this one must be an error
-#endif // __UNIX__
- };
-
- for ( size_t n = 0; n < WXSIZEOF(tmpprefixes); n++ )
- {
- wxString path = wxFileName::CreateTempFileName(tmpprefixes[n]);
- if ( path.empty() )
- {
- // "error" is not in upper case because it may be ok
- wxPrintf(wxT("Prefix '%s'\t-> error\n"), tmpprefixes[n]);
- }
- else
- {
- wxPrintf(wxT("Prefix '%s'\t-> temp file '%s'\n"),
- tmpprefixes[n], path.c_str());
-
- if ( !wxRemoveFile(path) )
- {
- wxLogWarning(wxT("Failed to remove temp file '%s'"),
- path.c_str());
- }
- }
- }
-}
-
-static void TestFileNameDirManip()
-{
- // TODO: test AppendDir(), RemoveDir(), ...
-}
-
-static void TestFileNameComparison()
-{
- // TODO!
-}
-
-static void TestFileNameOperations()
-{
- // TODO!
-}
-
-static void TestFileNameCwd()
-{
- // TODO!
-}
-
-#endif // TEST_FILENAME
-
-// ----------------------------------------------------------------------------
-// wxFileName time functions
-// ----------------------------------------------------------------------------
-
-#ifdef TEST_FILETIME
-
-#include "wx/filename.h"
-#include "wx/datetime.h"
-
-static void TestFileGetTimes()
-{
- wxFileName fn(wxT("testdata.fc"));
-
- wxDateTime dtAccess, dtMod, dtCreate;
- if ( !fn.GetTimes(&dtAccess, &dtMod, &dtCreate) )
- {
- wxPrintf(wxT("ERROR: GetTimes() failed.\n"));
- }
- else
- {
- static const wxChar *fmt = wxT("%Y-%b-%d %H:%M:%S");
-
- wxPrintf(wxT("File times for '%s':\n"), fn.GetFullPath().c_str());
- wxPrintf(wxT("Creation: \t%s\n"), dtCreate.Format(fmt).c_str());
- wxPrintf(wxT("Last read: \t%s\n"), dtAccess.Format(fmt).c_str());
- wxPrintf(wxT("Last write: \t%s\n"), dtMod.Format(fmt).c_str());
- }
-}
-
-#if 0
-static void TestFileSetTimes()
-{
- wxFileName fn(wxT("testdata.fc"));
-
- if ( !fn.Touch() )
- {
- wxPrintf(wxT("ERROR: Touch() failed.\n"));
- }
-}
-#endif
-
-#endif // TEST_FILETIME
-