summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKyohei Uto <im@kyoheiu.dev>2024-01-20 06:28:15 +0900
committerKyohei Uto <im@kyoheiu.dev>2024-01-20 06:28:15 +0900
commit5123d53d14b5d4762d8b4154579d31de9932f955 (patch)
treeacf2bdd2a9c7d6dfe1dea539c7ed0e87775bf2a9
parent5f582bc5fff72675fbc96062f5d70930f9be0320 (diff)
Remove unused method
-rw-r--r--src/state.rs28
1 files changed, 0 insertions, 28 deletions
diff --git a/src/state.rs b/src/state.rs
index 7cfecf6..3401eca 100644
--- a/src/state.rs
+++ b/src/state.rs
@@ -40,7 +40,6 @@ use std::os::unix::fs::PermissionsExt;
pub const BEGINNING_ROW: u16 = 3;
pub const EMPTY_WARNING: &str = "Are you sure to empty the trash directory? (if yes: y)";
-const BASE32: &[u8; 32] = b"0123456789ABCDEFGHJKMNPQRSTVWXYZ";
#[derive(Debug)]
pub struct State {
@@ -1360,33 +1359,6 @@ impl State {
}
}
- /// Creates temp file for directory. Works like touch, but with randomized suffix
- #[allow(dead_code)]
- pub fn create_temp(&mut self, is_dir: bool) -> Result<PathBuf, FxError> {
- let mut new_name = self.current_dir.join(".tmp");
- if new_name.exists() {
- let mut nanos = std::time::SystemTime::now()
- .duration_since(UNIX_EPOCH)
- .unwrap()
- .subsec_nanos();
- let encoded: &mut [u8] = &mut [0, 0, 0, 0, 0];
- for i in 0..5 {
- let v = (nanos & 0x1f) as usize;
- encoded[4 - i] = BASE32[v];
- nanos >>= 5;
- }
- new_name = self
- .current_dir
- .join(format!(".tmp_{}", String::from_utf8(encoded.to_vec())?))
- }
- if is_dir {
- std::fs::create_dir(new_name.clone())?;
- } else {
- std::fs::File::create(new_name.clone())?;
- }
- Ok(new_name)
- }
-
/// Show help
pub fn show_help(&self, mut screen: &Stdout) -> Result<(), FxError> {
clear_all();