You've already forked KernelSU-Next
mirror of
https://github.com/KernelSU-Next/KernelSU-Next.git
synced 2025-08-27 23:46:34 +00:00
Fix formatting (#266)
This commit is contained in:
@@ -12,8 +12,8 @@ use is_executable::is_executable;
|
||||
use java_properties::PropertiesIter;
|
||||
use log::{info, warn};
|
||||
|
||||
use std::fs::OpenOptions;
|
||||
use std::fs;
|
||||
use std::fs::OpenOptions;
|
||||
use std::io;
|
||||
use std::{
|
||||
collections::HashMap,
|
||||
@@ -381,26 +381,25 @@ fn _install_module(zip: &str) -> Result<()> {
|
||||
fn parse_size(size_str: &str) -> io::Result<u64> {
|
||||
let size_str = size_str.trim();
|
||||
if size_str.is_empty() {
|
||||
return Err(io::Error::new(io::ErrorKind::InvalidData, "Empty size string"));
|
||||
return Err(io::Error::new(
|
||||
io::ErrorKind::InvalidData,
|
||||
"Empty size string",
|
||||
));
|
||||
}
|
||||
|
||||
let (num, unit) = size_str.split_at(size_str.len().saturating_sub(1));
|
||||
let num = u64::from_str(num.trim()).map_err(|_| io::Error::new(io::ErrorKind::InvalidData, "Invalid number"))?;
|
||||
|
||||
let num = u64::from_str(num.trim())
|
||||
.map_err(|_| io::Error::new(io::ErrorKind::InvalidData, "Invalid number"))?;
|
||||
let multiplier = match unit.to_ascii_uppercase().as_str() {
|
||||
"G" => 1 << 30,
|
||||
"M" => 1 << 20,
|
||||
"K" => 1 << 10,
|
||||
_ => 1, // Default to bytes if no unit is specified
|
||||
};
|
||||
|
||||
Ok(num * multiplier)
|
||||
}
|
||||
|
||||
fn get_sparse_image_size() -> u64 {
|
||||
let default_size = 6 << 30; // 6GB
|
||||
let custom_size_file = "/data/adb/ksu/custom_sparse_size.txt";
|
||||
|
||||
match fs::read_to_string(custom_size_file) {
|
||||
Ok(contents) => match parse_size(&contents) {
|
||||
Ok(size) => size,
|
||||
|
||||
Reference in New Issue
Block a user