Merge branch 'filename-resolve-symlink'

Add wxFileName::ResolveLink().

See https://github.com/wxWidgets/wxWidgets/pull/2300
This commit is contained in:
Vadim Zeitlin
2021-04-07 12:38:37 +02:00
5 changed files with 153 additions and 4 deletions

View File

@@ -266,8 +266,6 @@ wxULongLong wxInvalidSize;
@li wxFileName::SetName()
@li wxFileName::SetVolume()
You can initialize a wxFileName instance using one of the following functions:
@section filename_operations File name operations
@@ -287,6 +285,24 @@ wxULongLong wxInvalidSize;
@li wxFileName::Mkdir()
@li wxFileName::Rmdir()
@section symlink_behavior Behavior with symlinks
wxFileName instances can store the path to symlinks on systems that support them.
When the path is for a symlink, the behavior of the following methods can be modified
to either operate on the symlink itself or on the file the link points to.
@li wxFileName::FileExists()
@li wxFileName::DirExists()
@li wxFileName::Exists()
@li wxFileName::SameAs()
@li wxFileName::GetTimes()
By default, those functions will operate on the target of the link, but they can be
made to operate on the link itself by calling wxFileName::DontFollowLink(). The current
link-following mode can be examined by calling wxFileName::ShouldFollowLink().
The wxFileName::ResolveLink() method can be used to get the absolute path for the target
of the symlink.
@library{wxbase}
@category{file}
@@ -1138,6 +1154,24 @@ public:
*/
bool ReplaceHomeDir(wxPathFormat format = wxPATH_NATIVE);
/**
Find the absolute path of the file/directory that is pointed to by this
path.
If this path isn't a symlink, then this function will return the current
path. If the path does not exist on disk, An empty wxFileName instance
will be returned.
@note This is only supported on Unix-like platforms (e.g. wxGTK, wxOSX),
on other platforms (e.g. wxMSW) this function just returns the
current path.
@since 3.1.5
@return The absolute path that the current symlink path points to.
*/
wxFileName ResolveLink();
/**
Deletes the specified directory from the file system.