After the fixes to UNC paths handling, Normalize(wxPATH_NORM_LONG)
started adding an extra colon after the UNC paths.
Fix this by using wxGetVolumeString() instead of constructing this thing
manually and add a unit test checking for this.
Closes#22275.
/dev/log doesn't exist in certain types of containers (e.g., Fedora's
build system). Additionally, this enables us to run this test on
platforms other than Linux.
Closes#22090.
It seems that the default value of NtfsDisable8dot3NameCreation registry
value is 2, and not 0, since a very long time (at least Windows 7), so
the wxPATH_NORM_LONG test was never actually executed.
Change the check guarding it to check if the value of the key is
different from 1 instead of checking that it is 0, as the test can still
succeed on the systems where this is the case.
Of course, it can also fail, if short names are disabled for the current
volume, but let's see if this is a problem in practice before doing
something more complicated to deal with this case.
This file already exists in the test directory, as it's used by another
test, so just use it instead of relying on the existing of mkinstalldirs
in the parent directory, which is not guaranteed as CMake build runs the
tests from a different directory, which is not the immediate child of
the top source directory.
Don't use GetVolumeSeparator() to combine UNC or GUID volumes with
paths, this doesn't work because this kind of paths doesn't contain
colons at all.
Update the documentation to mention this.
This comes at the price of breaking compatibility and returning
"\\share" rather than just "share" from wxFileName::GetVolume() for the
UNC paths. This breakage seems justified because it is required in order
to allow application code to distinguish between paths "x:\foo" and
"\\x\foo", which was previously impossible as GetVolume() returned just
"x" in both cases.
Document this change, adjust the existing checks for the new GetVolume()
semantics and add a new test which passes now, but didn't pass before.
Closes#19255.
This commit is best viewed ignoring whitespace-only changes.
Creating a directory with the leading path separator unexpectedly
created it under the current directory rather than in the root of the
current drive under MSW, due to the path being considered relative, in
spite of starting with the path separator, because it didn't have the
volume.
Fix this by avoiding the use of IsAbsolute() in Mkdir() and checking for
m_relative instead, as it seems the safest possible fix for this bug
because changing IsAbsolute() to return true in this case might change
the behaviour of the existing code.
Closes#4470.
Extend the existing workaround to work not only with explicitly
wxPATH_DOS paths, but with paths implicitly using the DOS format due to
it being the default format for the current platform.
Closes#19261.
This will allow using this class in the library code too.
No real changes yet, this is a pure refactoring.
This commit is best viewed using git --color-moved option.
This wrapper simply combines the calls to MakeAbsolute() and
GetFullPath(), but using it results in shorter and more clear code, so
it seems to be worth having.
Using wxFileName::Normalize() with default flags could be surprising and
result in bugs in the code, as shown by our own wrong use of it in
wxFileSystemWatcher corrected in the previous commit.
Deprecate using it without any flags and recommend using MakeAbsolute()
instead.
Also improve the related parts of the documentation.
Don't assume that files in /sys are 4KiB in size, their actual size is
equal to the kernel page size which varies depending on the architecture
and kernel build options.
This reverts commit 41f6f17d01 ("return 0
(meaning the file is not seekable, as the docs now explain) instead of
4KB for the files in sysfs under Linux") as it seems to be wrong to
return a value different from what "ls -l" or "stat" return here and the
original problem was solved in a better way in the previous commit.
See #9965.
Closes#17818.
Use wxString::t_str() with a function taking LPCTSTR (which is either
LPCWSTR or LPCSTR). And wxStrg::wc_str() for LPCOLESTR which,
ordinarily, is a wide string.
These tests don't seem to be sound, it's possible for one second or more to
pass between the two calls to GetTimes() and it's apparently possible for the
access time on the symlink to not change (due to /tmp being mounted with
"noatime" option perhaps?), resulting in Travis CI build failures.
The expected result in this case is ".", but the filename became empty instead
when wxPATH_NATIVE was used.
Fix this by examining GetFormat(format), which takes care of mapping
wxPATH_NATIVE to its real value, instead of wxPATH_NATIVE itself.
Also add a unit test verifying that this works as expected.
Closes#17010.
wxFileName::MakeRelativeTo() is only supposed to change the path of the file,
not its name, but it was doing the latter for the shortcuts as it implicitly
resolved them to the name of their target.
Fix this by ensuring we do not use wxPATH_NORM_SHORTCUT in MakeRelativeTo().
Closes#16239.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@77509 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
Don't support this compiler any more, this allows to get rid of tons of
MSVC6-specific workarounds, in particular we can now use Bind() and natural
template functions calls in the library code.
Also remove MSVC6 project and solution files and don't generate them when
bakefile_gen is ran any more (removing the remaining occurrences of msvc6prj
from the bakefiles results in weird bake-time errors, so it's simpler to just
leave them there).
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76532 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This keyword is not expanded by Git which means it's not replaced with the
correct revision value in the releases made using git-based scripts and it's
confusing to have lines with unexpanded "$Id$" in the released files. As
expanding them with Git is not that simple (it could be done with git archive
and export-subst attribute) and there are not many benefits in having them in
the first place, just remove all these lines.
If nothing else, this will make an eventual transition to Git simpler.
Closes#14487.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74602 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
The result was (consistently, so the tests still passed) off by an hour when
the program was ran while DST was in effect. Fix this by avoiding the use of
FileTimeToLocalFileTime() and LocalFileTimeToFileTime() and just directly
converting FILETIME values to wxDateTime. Not only this is more correct but
it's also simpler and more efficient as well.
Also add a unit test for wxFileName::SetTimes() too.
Closes#13098.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74423 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
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
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
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
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
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