alnyan/yggdrasil: symlink creation
This commit is contained in:
parent
034343146e
commit
7e037c9d4e
@ -1,8 +1,12 @@
|
|||||||
#![unstable(feature = "yggdrasil_os", issue = "none")]
|
#![unstable(feature = "yggdrasil_os", issue = "none")]
|
||||||
|
|
||||||
use yggdrasil_rt::io::FileMode;
|
use yggdrasil_rt::io::FileMode;
|
||||||
|
use yggdrasil_rt::sys as syscall;
|
||||||
|
|
||||||
use crate::fs::{Metadata, OpenOptions};
|
use crate::fs::{Metadata, OpenOptions};
|
||||||
|
use crate::io;
|
||||||
|
use crate::path::Path;
|
||||||
|
use crate::sys::cvt_io;
|
||||||
use crate::sys_common::{AsInner, AsInnerMut};
|
use crate::sys_common::{AsInner, AsInnerMut};
|
||||||
|
|
||||||
#[unstable(feature = "yggdrasil_os", issue = "none")]
|
#[unstable(feature = "yggdrasil_os", issue = "none")]
|
||||||
@ -42,3 +46,11 @@ impl OpenOptionsExt for OpenOptions {
|
|||||||
self
|
self
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[unstable(feature = "yggdrasil_os", issue = "none")]
|
||||||
|
pub fn symlink<P: AsRef<Path>, Q: AsRef<Path>>(target: P, path: Q) -> Result<(), io::Error> {
|
||||||
|
let target = target.as_ref().to_str().unwrap();
|
||||||
|
let path = path.as_ref().to_str().unwrap();
|
||||||
|
|
||||||
|
cvt_io(unsafe { syscall::create_symlink(None, target, path) })
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user