Add .concatenate() method to PathGet on Windows.

This commit is contained in:
Marcin Mielniczuk
2019-08-14 15:15:23 +02:00
committed by Jakub Konka
parent 7a991921bf
commit 2ed69b1d10
2 changed files with 20 additions and 8 deletions

View File

@@ -1,12 +1,23 @@
#![allow(non_camel_case_types)]
use crate::sys::host_impl;
use crate::{host, Result};
use crate::hostcalls_impl::PathGet;
use std::ffi::{OsStr, OsString};
use std::fs::File;
use std::os::windows::ffi::{OsStrExt, OsStringExt};
use std::os::windows::prelude::AsRawHandle;
use std::path::{Path, PathBuf};
pub(crate) trait PathGetExt {
fn concatenate(&self) -> Result<PathBuf>;
}
impl PathGetExt for PathGet {
fn concatenate(&self) -> Result<PathBuf> {
concatenate(self.dirfd(), Path::new(self.path()))
}
}
pub(crate) fn path_open_rights(
rights_base: host::__wasi_rights_t,
rights_inheriting: host::__wasi_rights_t,