|
|
@ -5,15 +5,17 @@ |
|
|
|
// TODO: Refactor service to accomodate for various changes (such as SMDH support). Properly document the public API.
|
|
|
|
// TODO: Refactor service to accomodate for various changes (such as SMDH support). Properly document the public API.
|
|
|
|
#![doc(alias = "filesystem")] |
|
|
|
#![doc(alias = "filesystem")] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
use bitflags::bitflags; |
|
|
|
use std::ffi::OsString; |
|
|
|
use std::ffi::OsString; |
|
|
|
use std::io::{ |
|
|
|
use std::io::Error as IoError; |
|
|
|
Error as IoError, ErrorKind as IoErrorKind, Read, Result as IoResult, Seek, SeekFrom, Write, |
|
|
|
use std::io::ErrorKind as IoErrorKind; |
|
|
|
}; |
|
|
|
use std::io::Result as IoResult; |
|
|
|
|
|
|
|
use std::io::{Read, Seek, SeekFrom, Write}; |
|
|
|
|
|
|
|
use std::mem; |
|
|
|
use std::path::{Path, PathBuf}; |
|
|
|
use std::path::{Path, PathBuf}; |
|
|
|
|
|
|
|
use std::ptr; |
|
|
|
|
|
|
|
use std::slice; |
|
|
|
use std::sync::Arc; |
|
|
|
use std::sync::Arc; |
|
|
|
use std::{mem, ptr, slice}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
use bitflags::bitflags; |
|
|
|
|
|
|
|
use widestring::{WideCStr, WideCString}; |
|
|
|
use widestring::{WideCStr, WideCString}; |
|
|
|
|
|
|
|
|
|
|
|
bitflags! { |
|
|
|
bitflags! { |
|
|
@ -259,8 +261,8 @@ pub struct Metadata { |
|
|
|
/// let mut fs = Fs::new().unwrap();
|
|
|
|
/// let mut fs = Fs::new().unwrap();
|
|
|
|
/// let mut sdmc_archive = fs.sdmc().unwrap();
|
|
|
|
/// let mut sdmc_archive = fs.sdmc().unwrap();
|
|
|
|
/// let result = OpenOptions::new()
|
|
|
|
/// let result = OpenOptions::new()
|
|
|
|
/// .read(true)
|
|
|
|
/// .read(true)
|
|
|
|
/// .archive(&sdmc_archive)
|
|
|
|
/// .archive(&sdmc_archive)
|
|
|
|
/// .open("foo.txt");
|
|
|
|
/// .open("foo.txt");
|
|
|
|
///
|
|
|
|
///
|
|
|
|
/// assert!(result.is_err());
|
|
|
|
/// assert!(result.is_err());
|
|
|
@ -276,12 +278,12 @@ pub struct Metadata { |
|
|
|
/// let mut fs = Fs::new().unwrap();
|
|
|
|
/// let mut fs = Fs::new().unwrap();
|
|
|
|
/// let mut sdmc_archive = fs.sdmc().unwrap();
|
|
|
|
/// let mut sdmc_archive = fs.sdmc().unwrap();
|
|
|
|
/// let file = OpenOptions::new()
|
|
|
|
/// let file = OpenOptions::new()
|
|
|
|
/// .read(true)
|
|
|
|
/// .read(true)
|
|
|
|
/// .write(true)
|
|
|
|
/// .write(true)
|
|
|
|
/// .create(true)
|
|
|
|
/// .create(true)
|
|
|
|
/// .archive(&sdmc_archive)
|
|
|
|
/// .archive(&sdmc_archive)
|
|
|
|
/// .open("/foo.txt")
|
|
|
|
/// .open("/foo.txt")
|
|
|
|
/// .unwrap();
|
|
|
|
/// .unwrap();
|
|
|
|
/// ```
|
|
|
|
/// ```
|
|
|
|
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)] |
|
|
|
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)] |
|
|
|
pub struct OpenOptions { |
|
|
|
pub struct OpenOptions { |
|
|
@ -392,7 +394,7 @@ impl File { |
|
|
|
/// # let _runner = test_runner::GdbRunner::default();
|
|
|
|
/// # let _runner = test_runner::GdbRunner::default();
|
|
|
|
/// use ctru::services::fs::{File, Fs};
|
|
|
|
/// use ctru::services::fs::{File, Fs};
|
|
|
|
///
|
|
|
|
///
|
|
|
|
/// let mut fs = Fs::new().unwrap();
|
|
|
|
/// let mut fs = Fs::new().unwrap();
|
|
|
|
/// let mut sdmc_archive = fs.sdmc().unwrap();
|
|
|
|
/// let mut sdmc_archive = fs.sdmc().unwrap();
|
|
|
|
/// // Non-existent file:
|
|
|
|
/// // Non-existent file:
|
|
|
|
/// assert!(File::open(&sdmc_archive, "/foo.txt").is_err());
|
|
|
|
/// assert!(File::open(&sdmc_archive, "/foo.txt").is_err());
|
|
|
@ -421,7 +423,7 @@ impl File { |
|
|
|
/// # let _runner = test_runner::GdbRunner::default();
|
|
|
|
/// # let _runner = test_runner::GdbRunner::default();
|
|
|
|
/// use ctru::services::fs::{File, Fs};
|
|
|
|
/// use ctru::services::fs::{File, Fs};
|
|
|
|
///
|
|
|
|
///
|
|
|
|
/// let mut fs = Fs::new().unwrap();
|
|
|
|
/// let mut fs = Fs::new().unwrap();
|
|
|
|
/// let mut sdmc_archive = fs.sdmc().unwrap();
|
|
|
|
/// let mut sdmc_archive = fs.sdmc().unwrap();
|
|
|
|
/// let mut f = File::create(&mut sdmc_archive, "/foo.txt").unwrap();
|
|
|
|
/// let mut f = File::create(&mut sdmc_archive, "/foo.txt").unwrap();
|
|
|
|
/// ```
|
|
|
|
/// ```
|
|
|
|