|
|
|
@ -103,7 +103,7 @@ pub struct Fs(());
@@ -103,7 +103,7 @@ pub struct Fs(());
|
|
|
|
|
/// ```no_run
|
|
|
|
|
/// use ctru::services::fs::Fs;
|
|
|
|
|
///
|
|
|
|
|
/// let fs = Fs::init().unwrap();
|
|
|
|
|
/// let fs = Fs::new().unwrap();
|
|
|
|
|
/// let sdmc_archive = fs.sdmc().unwrap();
|
|
|
|
|
/// ```
|
|
|
|
|
pub struct Archive { |
|
|
|
@ -126,7 +126,7 @@ pub struct Archive {
@@ -126,7 +126,7 @@ pub struct Archive {
|
|
|
|
|
/// use std::io::prelude::*;
|
|
|
|
|
/// use ctru::services::fs::{Fs, File};
|
|
|
|
|
///
|
|
|
|
|
/// let fs = Fs::init()?;
|
|
|
|
|
/// let fs = Fs::new()?;
|
|
|
|
|
/// let sdmc = fs.sdmc()?;
|
|
|
|
|
///
|
|
|
|
|
/// let mut file = File::create(&sdmc, "/foo.txt")?;
|
|
|
|
@ -139,7 +139,7 @@ pub struct Archive {
@@ -139,7 +139,7 @@ pub struct Archive {
|
|
|
|
|
/// use std::io::prelude::*;
|
|
|
|
|
/// use ctru::services::fs::{Fs, File};
|
|
|
|
|
///
|
|
|
|
|
/// let fs = Fs::init()?;
|
|
|
|
|
/// let fs = Fs::new()?;
|
|
|
|
|
/// let sdmc = fs.sdmc()?;
|
|
|
|
|
///
|
|
|
|
|
/// let mut file = File::open(&sdmc, "/foo.txt")?;
|
|
|
|
@ -156,7 +156,7 @@ pub struct Archive {
@@ -156,7 +156,7 @@ pub struct Archive {
|
|
|
|
|
/// use std::io::prelude::*;
|
|
|
|
|
/// use ctru::services::fs::{Fs, File};
|
|
|
|
|
///
|
|
|
|
|
/// let fs = Fs::init()?;
|
|
|
|
|
/// let fs = Fs::new()?;
|
|
|
|
|
/// let sdmc = fs.sdmc()?;
|
|
|
|
|
///
|
|
|
|
|
/// let file = File::open(&sdmc, "/foo.txt")?;
|
|
|
|
@ -209,7 +209,7 @@ pub struct Metadata {
@@ -209,7 +209,7 @@ pub struct Metadata {
|
|
|
|
|
/// ```no_run
|
|
|
|
|
/// use ctru::services::fs::{Fs, OpenOptions};
|
|
|
|
|
///
|
|
|
|
|
/// let fs = Fs::init().unwrap();
|
|
|
|
|
/// let fs = Fs::new().unwrap();
|
|
|
|
|
/// let sdmc_archive = fs.sdmc().unwrap();
|
|
|
|
|
/// let file = OpenOptions::new()
|
|
|
|
|
/// .read(true)
|
|
|
|
@ -224,7 +224,7 @@ pub struct Metadata {
@@ -224,7 +224,7 @@ pub struct Metadata {
|
|
|
|
|
/// ```no_run
|
|
|
|
|
/// use ctru::services::fs::{Fs, OpenOptions};
|
|
|
|
|
///
|
|
|
|
|
/// let fs = Fs::init().unwrap();
|
|
|
|
|
/// let fs = Fs::new().unwrap();
|
|
|
|
|
/// let sdmc_archive = fs.sdmc().unwrap();
|
|
|
|
|
/// let file = OpenOptions::new()
|
|
|
|
|
/// .read(true)
|
|
|
|
@ -298,7 +298,7 @@ impl Fs {
@@ -298,7 +298,7 @@ impl Fs {
|
|
|
|
|
/// ctrulib services are reference counted, so this function may be called
|
|
|
|
|
/// as many times as desired and the service will not exit until all
|
|
|
|
|
/// instances of Fs drop out of scope.
|
|
|
|
|
pub fn init() -> crate::Result<Fs> { |
|
|
|
|
pub fn new() -> crate::Result<Fs> { |
|
|
|
|
unsafe { |
|
|
|
|
let r = ctru_sys::fsInit(); |
|
|
|
|
if r < 0 { |
|
|
|
@ -351,7 +351,7 @@ impl File {
@@ -351,7 +351,7 @@ impl File {
|
|
|
|
|
/// ```no_run
|
|
|
|
|
/// use ctru::services::fs::{Fs, File};
|
|
|
|
|
///
|
|
|
|
|
/// let fs = Fs::init().unwrap();
|
|
|
|
|
/// let fs = Fs::new().unwrap();
|
|
|
|
|
/// let sdmc_archive = fs.sdmc().unwrap();
|
|
|
|
|
/// let mut f = File::open(&sdmc_archive, "/foo.txt").unwrap();
|
|
|
|
|
/// ```
|
|
|
|
@ -380,7 +380,7 @@ impl File {
@@ -380,7 +380,7 @@ impl File {
|
|
|
|
|
/// ```no_run
|
|
|
|
|
/// use ctru::services::fs::{Fs, File};
|
|
|
|
|
///
|
|
|
|
|
/// let fs = Fs::init().unwrap();
|
|
|
|
|
/// let fs = Fs::new().unwrap();
|
|
|
|
|
/// let sdmc_archive = fs.sdmc().unwrap();
|
|
|
|
|
/// let mut f = File::create(&sdmc_archive, "/foo.txt").unwrap();
|
|
|
|
|
/// ```
|
|
|
|
|