pub struct ResolveFullPath { /* private fields */ }Expand description
An owned, marshalable parameter set for GetFullPathNameW.
§Example
use windows_namespace_request_sys::full_path::ResolveFullPath;
use wtf_string::Wtf16String;
// `.` and `..` are collapsed as string work, with no component verified:
// this holds whether or not `C:\Windows\System32` exists.
let resolved = ResolveFullPath::new(Wtf16String::from(r"C:\Windows\System32\..\.\Temp"))
.perform()?
.to_string_lossy();
assert_eq!(resolved, r"C:\Windows\Temp");§Example: it does not check existence
use windows_namespace_request_sys::full_path::ResolveFullPath;
use wtf_string::Wtf16String;
// A path to nothing resolves perfectly happily, because the call
// does not verify it. A consumer wanting a verified path wants an open
// plus GetFinalPathNameByHandleW instead.
let resolved = ResolveFullPath::new(Wtf16String::from(r"C:\no-such-directory\..\file.txt"))
.perform()?
.to_string_lossy();
assert_eq!(resolved, r"C:\file.txt");Implementations§
Source§impl ResolveFullPath
impl ResolveFullPath
Sourcepub fn new(path: Wtf16String) -> Self
pub fn new(path: Wtf16String) -> Self
Begins a request to resolve path.
Takes a raw path rather than a crate::path::PreparedPath, because
preparation is what this call performs. Handing it an already-prepared
path would be resolving twice.
Sourcepub fn perform(&self) -> Result<Wtf16String, FullPathError>
pub fn perform(&self) -> Result<Wtf16String, FullPathError>
Performs the call on the calling thread, growing the buffer as needed.
Resolution happens against the current directory of whichever thread
performs this, which is the one thing a caller must keep in mind: a
request built on a submitter and performed on a worker resolves against
the process current directory as it stands at performance time.
crate::path::prepare is the function for pinning that at
construction.
§Errors
Returns FullPathError::Win32 with the raw Win32 code, unaltered, or
FullPathError::Unstable if the required size kept changing.
Trait Implementations§
Source§impl Clone for ResolveFullPath
impl Clone for ResolveFullPath
Source§fn clone(&self) -> ResolveFullPath
fn clone(&self) -> ResolveFullPath
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more