pub fn open_ambient_dir(
    path: &Path,
    ambient_authority: AmbientAuthority
) -> Result<File>
Expand description

Open a directory named by a bare path, using the host process’ ambient authority.

Ambient Authority

This function is not sandboxed and may trivially access any path that the host process has access to.

Examples found in repository?
src/windows/fs/dir_entry_inner.rs (line 36)
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
    pub(crate) fn open(&self, options: &OpenOptions) -> io::Result<fs::File> {
        match options.follow {
            FollowSymlinks::No => {
                let (opts, manually_trunc) = open_options_to_std(options);
                let file = opts.open(self.std.path())?;
                if manually_trunc {
                    // Unwrap is ok because 0 never overflows, and we'll only
                    // have `manually_trunc` set when the file is opened for
                    // writing.
                    file.set_len(0).unwrap();
                }
                Ok(file)
            }
            FollowSymlinks::Yes => {
                let path = self.std.path();
                open(
                    &open_ambient_dir(path.parent().unwrap(), ambient_authority())?,
                    path.file_name().unwrap().as_ref(),
                    options,
                )
            }
        }
    }