Skip to content

Commit

Permalink
qol: improve store.rs imports
Browse files Browse the repository at this point in the history
  • Loading branch information
Xevion committed Apr 24, 2024
1 parent 137e747 commit 9d3a68e
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/store.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
use std::{io::Seek, path::PathBuf};

#[cfg(not(target_os = "emscripten"))]
pub struct Store {
file: std::fs::File,
Expand All @@ -10,7 +8,7 @@ pub struct Store;

#[cfg(not(target_os = "emscripten"))]
impl Store {
pub fn new () -> Self {
pub fn new() -> Self {
let path = Store::get_path();
let file = std::fs::OpenOptions::new()
.read(true)
Expand All @@ -21,7 +19,7 @@ impl Store {
Store { file }
}

fn get_path() -> PathBuf {
fn get_path() -> std::path::PathBuf {
use std::env;
let mut path = env::current_exe().unwrap();
path.pop();
Expand All @@ -38,7 +36,7 @@ impl Store {
}

pub fn set_volume(&mut self, volume: u32) {
use std::io::Write;
use std::io::{Seek, Write};

self.file.set_len(0).unwrap();
self.file.seek(std::io::SeekFrom::Start(0)).unwrap();
Expand All @@ -54,7 +52,7 @@ extern "C" {

#[cfg(target_os = "emscripten")]
impl Store {
pub fn new () -> Self {
pub fn new() -> Self {
Store
}

Expand Down Expand Up @@ -90,4 +88,4 @@ impl Store {
String::from(c_str.to_str().unwrap())
}
}
}
}

0 comments on commit 9d3a68e

Please sign in to comment.