Commit Graph

68 Commits

Author SHA1 Message Date
Vadim Zeitlin
9ff99cb543 Fix filename test compilation with VC6.
Just disable tests resulting in an internal compiler error.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72941 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-11-10 12:21:46 +00:00
Jouk Jansen
67b09eacea Fix for specific filename syntax of OpenVMS
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72919 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-11-07 09:00:25 +00:00
Vadim Zeitlin
58263bb4c3 Make wxFILE_EXISTS_SYMLINK work on its own, without wxFILE_EXISTS_NO_FOLLOW.
Include the wxFILE_EXISTS_NO_FOLLOW bit in wxFILE_EXISTS_SYMLINK definition to
allow using just wxFileName::Exists(wxFILE_EXISTS_SYMLINK) which used to never
work because the link was followed.

Closes #14777.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72777 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-10-25 22:30:43 +00:00
Vadim Zeitlin
25db2c25bc Don't follow symlinks in wxFileName::Rmdir(wxPATH_RMDIR_RECURSIVE).
Following symlinks, possibly leading outside of the directory being removed,
is at best surprising and at worst dangerous, so don't do it and just mimic
the behaviour of "rm -rf", i.e. remove everything inside this directory,
including the symlinks themselves, but don't follow them.

Closes #14649.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72742 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-10-23 23:58:17 +00:00
Vadim Zeitlin
988f7eec77 Revert accidental incompatible change to wxFileName::DirExists().
The non-static version tests for the existence of the directory part of the
object only as is explicitly mentioned in the documentation, so do the test on
GetPath() and not GetFullPath() as we did since r72707.

Also add a unit test for this behaviour.

Closes #14771.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72718 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-10-22 15:51:26 +00:00
Vadim Zeitlin
4213fd51cc Fix tests compilation in STL build after r72707.
Add an explicit call to wxString::c_str() as there is no implicit conversion
in STL build.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72713 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-10-20 14:48:50 +00:00
Vadim Zeitlin
c50db84779 Allow testing for existence of specific file types in wxFileName.
Add "flags" parameter to wxFileName::Exists() to allow testing for the
existing of files of specific type: not only regular or directory but also
symlink, device, FIFO or socket.

And also to pass wxFILE_EXISTS_NO_FOLLOW flag inhibiting following the
symlinks without using DontFollowLink().

Closes #14542.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72707 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-10-19 22:02:15 +00:00
Vadim Zeitlin
c063adebba Add support for symlinks to wxFileName.
Allow to work with the symlinks themselves and not the file they reference by
calling the new wxFileName::DontFollowLink().

Update Unix wxDir implementation to not treat symlinks to directories as
directories, this ensures that we don't recurse into the directories outside
of the original parent accidentally.

Closes #14542.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72680 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-10-15 01:09:01 +00:00
Vadim Zeitlin
fd78ef4715 Fix unit tests compilation in STL build.
Add missing c_str() calls forgotten by r70687.

Closes #14472.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72006 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-07-10 23:50:52 +00:00
Vadim Zeitlin
bb5a951418 Use __WINDOWS__ for OS checks and __WXMSW__ for GUI checks (round 2).
This is continuation of r70796 and serves the same purpose.

Closes #14065, #14066.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70808 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-03-04 20:31:42 +00:00
Vadim Zeitlin
7c9b6c9111 Compare file inodes if possible in wxFileName::SameAs().
This allows to correctly return when the two files with different names
actually refer to the same file system object.

Closes #910.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70687 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-02-25 23:49:35 +00:00
Vadim Zeitlin
41fec01fa9 Remove temporary files created by wxFileName unit test case.
Don't leave temporary files created by wxFileName::CreateTempFileName() lying
around.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70686 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-02-25 23:49:32 +00:00
Vadim Zeitlin
996d3fe3f8 Added wxFileName::Exists().
This function checks for existence of anything with the given name, not
necessarily just a file or a directory.

Extend the unit test to verify that it returns true for /dev/null on Unix
systems.

Closes #953.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70600 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-02-15 15:39:46 +00:00
Vadim Zeitlin
901504c383 Refactor wxFileName existence checking code.
Merge FileExists() and DirExists() together in a single
wxFileSystemObjectExists() helper in preparation for adding a function
checking for the existence of any kind of file system object.

There should be no changes for MSW/Unix but OS/2 file detection was changed
slightly to always use DosQueryPathInfo() instead of using it only for the
directories and stat() for files. Not sure if this is the right thing to do
there but it seems like the code should work.

Also add a simple unit test for these functions.

See #953.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70599 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-02-15 15:39:41 +00:00
Dimitri Schoolwerth
e3778b4d9c No code changes, fixed some typos.
Changed several occurrences of "it's" where "its" is meant, as well as a few other minor typos.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67656 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2011-04-30 10:57:04 +00:00
Vadim Zeitlin
f822acceee Don't consider extra ".." an error in wxFileName::Normalize().
The path being normalized could have come from user and there doesn't seem to
be any point in complaining about too many ".."s in it when we can handle them
correctly instead.

So simply ignore the extra ".."s for the absolute paths and keep them
unchanged for the relative ones instead of returning an error.

See #10960.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66218 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-11-20 23:53:28 +00:00
Francesco Montorsi
995202d020 small warning+PCH fixes
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64680 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-06-21 21:46:29 +00:00
Francesco Montorsi
d6609db5a7 minor change: use a "positive" logic: use shouldSucceed instead of shouldFail and use more descriptive names for non-existing folders; add a few test cases
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64677 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-06-21 19:44:27 +00:00
Francesco Montorsi
701aa4d804 revert previous revision about localization of decimal points in GetHumanReadableSize() test strings: using CLocaleSetter is a better solution.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64515 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-06-06 18:52:28 +00:00
Francesco Montorsi
1fe1aecb87 Move a couple of wxFileName tests from the console sample to the existing FileNameTestCase.
Fix FileNameTestCase::TestGetHumanReadable to check the result against expected strings using the correct decimal point for the locale used on the test machine.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64512 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-06-06 15:41:09 +00:00
Vadim Zeitlin
a07526187a Rename the rest of wxSIZE_CONV_TRADIONAL to wxSIZE_CONV_TRADITIONAL.
Fix tests compilation after r63886.

See #10673.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63891 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-04-07 10:50:41 +00:00
Vadim Zeitlin
58271f42ce Attempt to correct mysterious MSVC6 compilation error.
For some reasons MSVC6 refuses to compile TestData struct initialization. Try
to work around it by not using wxULongLong as this looks like the only thing
which might be confusing it.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63874 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-04-06 17:38:27 +00:00
Vadim Zeitlin
b2edb8f3c5 Add support for IEC and SI size units to wxFileName::GetHumanReadableSize().
Allow choosing the multiplier to use (1000 or 1024) and the names of the units
(SI or IEC). By default, still use traditional convention, i.e. multiplier of
1024 but SI unit names. This will probably need to be changed to use IEC units
in the future.

Also added unit test for this function.

Closes #10673.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63870 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-04-06 14:53:04 +00:00
Vadim Zeitlin
e01a788ee0 Add support for MSW unique volume names to wxFileName.
Recognize the paths starting with "\\?\Volume{GUID}" under MSW and provide a
way to test for them.

Closes #8874.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62782 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-12-05 17:31:00 +00:00
Vadim Zeitlin
acaa833787 Fix unit test added in r62561 to work under Windows too.
The unit test checking that slashes were allowed in UNCs too didn't work under
Windows because GetPath() returned volume as part of the path there (and also
used backslashes by default), fix it.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62579 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-11-09 18:20:05 +00:00
Vadim Zeitlin
7b611a3ae9 Recognize UNCs starting with forward slashes too in wxFileName.
Treat \\share\path and //share/path in the same way (for wxPATH_DOS paths).

Add a test for UNC parsing to the unit test.

Closes #11376.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62561 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-11-05 14:59:39 +00:00
Vadim Zeitlin
40152925d5 Extract operator<<(ostream, wxFileName) from filename test.
Putting this function in a header allows to reuse it in other tests, e.g. the
upcoming wxFileSystemWatcher one.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62473 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-10-22 11:34:43 +00:00
Vadim Zeitlin
60c4147a07 add more tests for wxFileName::Normalize(DOTS) (see #10960)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61318 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-07-03 22:07:22 +00:00
Vadim Zeitlin
be5be16a23 interpret ~ specially only when it is the first character of the path (closes #10948, see #10941)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61271 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-07-01 09:07:38 +00:00
Vadim Zeitlin
9630954d5d remove _T()s and wxChars from the test making it much more readable
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61270 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-07-01 09:02:30 +00:00
Vadim Zeitlin
525711d7a3 don't run wxPATH_NORM_LONG test on systems where the short file names are disabled
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59974 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-04-01 21:49:47 +00:00
Vadim Zeitlin
07c4e84f7b always declare TestStrip(), it is now available even without 2.8 compatibility
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59879 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-03-26 23:00:14 +00:00
Vadim Zeitlin
181dd701fa implement deprecated wxStripExtension() in terms of new wxFileName::StripExtension() (closes #10634)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59868 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-03-26 15:55:01 +00:00
Vadim Zeitlin
b3f76d404f disable warning about using deprecated wxStripExtension() for MSVC
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58612 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-02-01 22:20:59 +00:00
Francesco Montorsi
395f3aa8bd rewrite wxContractPath as wxFileName::ReplaceEnvVariable and wxFileName::ReplaceHomeDir; add test units and docs for them
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@57867 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-01-07 00:38:46 +00:00
Vadim Zeitlin
a779d8091c fix comparison in Normalize() test
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@56847 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-11-19 11:52:04 +00:00
Vadim Zeitlin
527587d347 really fix VC6 compilation of all testsi (without breaking VC9)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@56656 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-11-03 00:31:16 +00:00
Vadim Zeitlin
ea6319cb38 don't replace . and .. with the corresponding directoties names in GetLongPath() as this breaks the normalization of file names without wxPATH_NORM_DOTS flag (#9814)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@56247 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-10-12 15:15:32 +00:00
Vadim Zeitlin
5fed01a943 fix VC9 compilation: FileNameInfo identifier conflicts with an enum name in the SDK it uses, so rename it to TestFileNameInfo
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@55906 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-09-27 09:20:10 +00:00
Vadim Zeitlin
1de532f57e get rid of special WX_ASSERT_FOO_EQUAL macros by defining CppUnit::assertEquals() overloads for wx types
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@54696 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-07-18 23:07:23 +00:00
Vadim Zeitlin
9a0c5c012a do case normalization after long path one, this fixes the problem with incorrect paths case under Vista (closes 9162)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@53732 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-05-24 14:42:40 +00:00
Vadim Zeitlin
c7099635d1 add tests for wxPATH_NORM_CASE (unsuccessfully trying to reproduce the problem of #9162)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@53636 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-05-18 11:38:33 +00:00
Vadim Zeitlin
8e08370217 work around VC7 compiler bug resulting in a warning about FileNameTest being never instantiatable
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@53634 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-05-18 11:14:20 +00:00
Václav Slavík
4f03ec887b converting temporary wxString to const wxChar* and storing that doesn't work (and doesn't even compile if wxUSE_STL), fixed
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@51410 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-01-27 16:25:33 +00:00
Vadim Zeitlin
5098c258b2 compilation fixes for VC6
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@51188 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-01-13 01:13:03 +00:00
Václav Slavík
e7b54c0721 fixed typo: _T(), not _()
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45384 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-04-10 14:55:02 +00:00
Vadim Zeitlin
9b9596de5e corrected tests to deal with multiple consecutive (back)slashes
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@43996 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2006-12-17 14:49:50 +00:00
Vadim Zeitlin
34841b216c added test for parsing c:\\aaa\bbb\ccc paths (aaa shouldn't be interpreted as network share)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@43995 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2006-12-17 14:13:23 +00:00
Vadim Zeitlin
698581160d for for initializing wxFileName with empty string returning true from IsOk() and tests for the correct behaviour (patch 1617156)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@43992 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2006-12-16 23:11:48 +00:00
Vadim Zeitlin
b51abd7380 Unicode compilation fixes
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@43876 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2006-12-09 15:58:32 +00:00