Browse Source

Update crates to 2018

pull/13/head
AzureMarker 3 years ago
parent
commit
72dafc7fc2
No known key found for this signature in database
GPG Key ID: 47A133F3BF9D03D3
  1. 1
      ctru-rs/Cargo.toml
  2. 26
      ctru-rs/src/services/fs.rs
  3. 1
      ctru-sys/Cargo.toml

1
ctru-rs/Cargo.toml

@ -4,6 +4,7 @@ description = "A safe wrapper around smealum's ctrulib."
license = "https://en.wikipedia.org/wiki/Zlib_License" license = "https://en.wikipedia.org/wiki/Zlib_License"
name = "ctru-rs" name = "ctru-rs"
version = "0.7.1" version = "0.7.1"
edition = "2018"
[lib] [lib]
crate-type = ["rlib"] crate-type = ["rlib"]

26
ctru-rs/src/services/fs.rs

@ -317,7 +317,7 @@ impl Fs {
let path = ctru_sys::fsMakePath(PathType::Empty.into(), ptr::null() as _); let path = ctru_sys::fsMakePath(PathType::Empty.into(), ptr::null() as _);
let r = ctru_sys::FSUSER_OpenArchive(&mut handle, id.into(), path); let r = ctru_sys::FSUSER_OpenArchive(&mut handle, id.into(), path);
if r < 0 { if r < 0 {
Err(::Error::from(r)) Err(crate::Error::from(r))
} else { } else {
Ok(Archive { Ok(Archive {
handle: handle, handle: handle,
@ -410,7 +410,7 @@ impl File {
if r < 0 { if r < 0 {
Err(IoError::new( Err(IoError::new(
IoErrorKind::PermissionDenied, IoErrorKind::PermissionDenied,
::Error::from(r), crate::Error::from(r),
)) ))
} else { } else {
Ok(()) Ok(())
@ -428,7 +428,7 @@ impl File {
if r < 0 { if r < 0 {
Err(IoError::new( Err(IoError::new(
IoErrorKind::PermissionDenied, IoErrorKind::PermissionDenied,
::Error::from(r), crate::Error::from(r),
)) ))
} else { } else {
Ok(Metadata { Ok(Metadata {
@ -451,7 +451,7 @@ impl File {
); );
self.offset += n_read as u64; self.offset += n_read as u64;
if r < 0 { if r < 0 {
Err(IoError::new(IoErrorKind::Other, ::Error::from(r))) Err(IoError::new(IoErrorKind::Other, crate::Error::from(r)))
} else { } else {
Ok(n_read as usize) Ok(n_read as usize)
} }
@ -475,7 +475,7 @@ impl File {
); );
self.offset += n_written as u64; self.offset += n_written as u64;
if r < 0 { if r < 0 {
Err(IoError::new(IoErrorKind::Other, ::Error::from(r))) Err(IoError::new(IoErrorKind::Other, crate::Error::from(r)))
} else { } else {
Ok(n_written as usize) Ok(n_written as usize)
} }
@ -612,7 +612,7 @@ impl OpenOptions {
0, 0,
); );
if r < 0 { if r < 0 {
return Err(IoError::new(IoErrorKind::Other, ::Error::from(r))); return Err(IoError::new(IoErrorKind::Other, crate::Error::from(r)));
} }
let mut file = File { let mut file = File {
@ -670,7 +670,7 @@ impl<'a> Iterator for ReadDir<'a> {
); );
if r < 0 { if r < 0 {
return Some(Err(IoError::new(IoErrorKind::Other, ::Error::from(r)))); return Some(Err(IoError::new(IoErrorKind::Other, crate::Error::from(r))));
} }
if entries_read != entry_count { if entries_read != entry_count {
return None; return None;
@ -723,7 +723,7 @@ pub fn create_dir<P: AsRef<Path>>(arch: &Archive, path: P) -> IoResult<()> {
FsAttribute::FS_ATTRIBUTE_DIRECTORY.bits(), FsAttribute::FS_ATTRIBUTE_DIRECTORY.bits(),
); );
if r < 0 { if r < 0 {
Err(IoError::new(IoErrorKind::Other, ::Error::from(r))) Err(IoError::new(IoErrorKind::Other, crate::Error::from(r)))
} else { } else {
Ok(()) Ok(())
} }
@ -781,7 +781,7 @@ pub fn remove_dir<P: AsRef<Path>>(arch: &Archive, path: P) -> IoResult<()> {
let fs_path = ctru_sys::fsMakePath(PathType::UTF16.into(), path.as_ptr() as _); let fs_path = ctru_sys::fsMakePath(PathType::UTF16.into(), path.as_ptr() as _);
let r = ctru_sys::FSUSER_DeleteDirectory(arch.handle, fs_path); let r = ctru_sys::FSUSER_DeleteDirectory(arch.handle, fs_path);
if r < 0 { if r < 0 {
Err(IoError::new(IoErrorKind::Other, ::Error::from(r))) Err(IoError::new(IoErrorKind::Other, crate::Error::from(r)))
} else { } else {
Ok(()) Ok(())
} }
@ -799,7 +799,7 @@ pub fn remove_dir_all<P: AsRef<Path>>(arch: &Archive, path: P) -> IoResult<()> {
let fs_path = ctru_sys::fsMakePath(PathType::UTF16.into(), path.as_ptr() as _); let fs_path = ctru_sys::fsMakePath(PathType::UTF16.into(), path.as_ptr() as _);
let r = ctru_sys::FSUSER_DeleteDirectoryRecursively(arch.handle, fs_path); let r = ctru_sys::FSUSER_DeleteDirectoryRecursively(arch.handle, fs_path);
if r < 0 { if r < 0 {
Err(IoError::new(IoErrorKind::Other, ::Error::from(r))) Err(IoError::new(IoErrorKind::Other, crate::Error::from(r)))
} else { } else {
Ok(()) Ok(())
} }
@ -825,7 +825,7 @@ pub fn read_dir<P: AsRef<Path>>(arch: &Archive, path: P) -> IoResult<ReadDir> {
let fs_path = ctru_sys::fsMakePath(PathType::UTF16.into(), path.as_ptr() as _); let fs_path = ctru_sys::fsMakePath(PathType::UTF16.into(), path.as_ptr() as _);
let r = ctru_sys::FSUSER_OpenDirectory(&mut handle, arch.handle, fs_path); let r = ctru_sys::FSUSER_OpenDirectory(&mut handle, arch.handle, fs_path);
if r < 0 { if r < 0 {
Err(IoError::new(IoErrorKind::Other, ::Error::from(r))) Err(IoError::new(IoErrorKind::Other, crate::Error::from(r)))
} else { } else {
Ok(ReadDir { Ok(ReadDir {
handle: Dir(handle), handle: Dir(handle),
@ -851,7 +851,7 @@ pub fn remove_file<P: AsRef<Path>>(arch: &Archive, path: P) -> IoResult<()> {
let fs_path = ctru_sys::fsMakePath(PathType::UTF16.into(), path.as_ptr() as _); let fs_path = ctru_sys::fsMakePath(PathType::UTF16.into(), path.as_ptr() as _);
let r = ctru_sys::FSUSER_DeleteFile(arch.handle, fs_path); let r = ctru_sys::FSUSER_DeleteFile(arch.handle, fs_path);
if r < 0 { if r < 0 {
Err(IoError::new(IoErrorKind::Other, ::Error::from(r))) Err(IoError::new(IoErrorKind::Other, crate::Error::from(r)))
} else { } else {
Ok(()) Ok(())
} }
@ -888,7 +888,7 @@ where
if r == 0 { if r == 0 {
return Ok(()); return Ok(());
} }
Err(IoError::new(IoErrorKind::Other, ::Error::from(r))) Err(IoError::new(IoErrorKind::Other, crate::Error::from(r)))
} }
} }

1
ctru-sys/Cargo.toml

@ -4,6 +4,7 @@ version = "0.4.0"
authors = ["Ronald Kinard <furyhunter600@gmail.com>"] authors = ["Ronald Kinard <furyhunter600@gmail.com>"]
license = "https://en.wikipedia.org/wiki/Zlib_License" license = "https://en.wikipedia.org/wiki/Zlib_License"
links = "ctru" links = "ctru"
edition = "2018"
[dependencies] [dependencies]
libc = { version = "0.2", default-features = false } libc = { version = "0.2", default-features = false }

Loading…
Cancel
Save