aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFenrir <[email protected]>2016-10-03 11:38:44 -0700
committerFenrir <[email protected]>2016-10-03 11:47:40 -0700
commit82bcf8f305c09f54e687b3517fbb9e694e6df296 (patch)
treeeffc86aa64201da98f6fc01775f18ea7373ca63d /src
parentMake OpenOptions logic slightly less ugly (diff)
downloadctru-rs-82bcf8f305c09f54e687b3517fbb9e694e6df296.tar.xz
ctru-rs-82bcf8f305c09f54e687b3517fbb9e694e6df296.zip
Fix documentation errors
Diffstat (limited to 'src')
-rw-r--r--src/services/fs.rs19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/services/fs.rs b/src/services/fs.rs
index c52addf..d4aedc4 100644
--- a/src/services/fs.rs
+++ b/src/services/fs.rs
@@ -54,7 +54,7 @@ pub enum ArchiveID {
/// Represents the filesystem service. No file IO can be performed
/// until an instance of this struct is created.
///
-/// The service exits when this struct goes out of scope.
+/// The service exits when all instances of this struct go out of scope.
pub struct Fs {
pd: PhantomData<i32>,
}
@@ -208,8 +208,13 @@ impl Fs {
/// # Errors
///
/// This function will return Err if there was an error initializing the
- /// FS service. This typically reflects a problem with the execution
- /// environment and not necessarily your program itself.
+ /// FS service, which in practice should never happen unless there is
+ /// an error in the execution environment (i.e. the homebrew launcher
+ /// somehow fails to provide fs:USER permissions)
+ ///
+ /// 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() -> Result<Fs, i32> {
unsafe {
let r = fsInit();
@@ -264,11 +269,11 @@ impl File {
/// # Examples
///
/// ```no_run
- /// use ctru::servies::fs::{Fs, File};
+ /// use ctru::services::fs::{Fs, File};
///
/// let fs = Fs::init().unwrap()
/// let sdmc_archive = fs.sdmc().unwrap()
- /// let mut f = File::open("/foo.txt").unwrap();
+ /// let mut f = File::open(&sdmc_archive, "/foo.txt").unwrap();
/// ```
pub fn open<P: AsRef<Path>>(arch: &Archive, path: P) -> Result<File, i32> {
OpenOptions::new().read(true).archive(arch).open(path.as_ref())
@@ -290,11 +295,11 @@ impl File {
/// # Examples
///
/// ```no_run
- /// use ctru::servies::fs::{Fs, File};
+ /// use ctru::services::fs::{Fs, File};
///
/// let fs = Fs::init().unwrap()
/// let sdmc_archive = fs.sdmc().unwrap()
- /// let mut f = File::create("/foo.txt").unwrap();
+ /// let mut f = File::create(&sdmc_archive, "/foo.txt").unwrap();
/// ```
pub fn create<P: AsRef<Path>>(arch: &Archive, path: P) -> Result<File, i32> {
OpenOptions::new().write(true).create(true).archive(arch).open(path.as_ref())