Skip to content

Commit

Permalink
Switch from tempdir to tempfile
Browse files Browse the repository at this point in the history
  • Loading branch information
kelpsyberry committed Mar 29, 2024
1 parent 2f1b154 commit 9c52119
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 78 deletions.
78 changes: 8 additions & 70 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions frontend/desktop/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ debug-views = [
"dust-core/channel-audio-capture",
]
gdb-server = ["gdb-protocol", "dust-core/debugger-hooks"]
dldi = ["fatfs", "tempdir"]
dldi = ["fatfs", "tempfile"]

discord-presence = ["discord-rpc"]

Expand Down Expand Up @@ -62,7 +62,7 @@ parking_lot = "0.12"
bitflags = "2.5"
miniz_oxide = { version = "0.7", features = ["simd"] }
fatfs = { version = "0.3", optional = true }
tempdir = { version = "0.3", optional = true }
tempfile = { version = "3.10", optional = true }
proc-bitfield = { version = "0.3", features = ["nightly"] }

# Config
Expand All @@ -86,4 +86,4 @@ gdb-protocol = { version = "0.1", optional = true }
[target.'cfg(target_os = "macos")'.dependencies]
cocoa = "0.25"
objc = "0.2"
tempdir = "0.3"
tempfile = "3.10"
4 changes: 2 additions & 2 deletions frontend/desktop/src/emu/dldi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use std::{
io::{self, Read, Seek, SeekFrom, Write},
path::{Path, PathBuf},
};
use tempdir::TempDir;
use tempfile::TempDir;

struct LoadedChunk {
index: u64,
Expand Down Expand Up @@ -257,7 +257,7 @@ impl FsProvider {
return Ok(());
}
let mut chunk_manager = ChunkManager {
temp_dir: TempDir::new("dust-dldi")?,
temp_dir: tempfile::Builder::new().prefix("dust-dldi").tempdir()?,
cur_addr: 0,
fs_max_size: 1 << 30,
chunk_size_shift: 22,
Expand Down
8 changes: 5 additions & 3 deletions frontend/desktop/src/ui/title_menu_bar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use imgui::{Image, TextureId};
use std::path::PathBuf;
use std::{fmt::Write, path::Path};
#[cfg(target_os = "macos")]
use tempdir::TempDir;
use tempfile::TempDir;

bitflags::bitflags! {
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
Expand Down Expand Up @@ -57,7 +57,7 @@ impl TitleMenuBarState {
game_file_path: None,
#[cfg(target_os = "macos")]
temp_icon_dir: if config!(_config, game_icon_mode) == GameIconMode::Game {
TempDir::new("dust-icons").ok()
tempfile::Builder::new().prefix("dust-icons").tempdir().ok()
} else {
None
},
Expand Down Expand Up @@ -292,7 +292,9 @@ impl TitleMenuBarState {
match config!(config, game_icon_mode) {
GameIconMode::None => None,
GameIconMode::File => None,
GameIconMode::Game => TempDir::new("dust-icons").ok(),
GameIconMode::Game => {
tempfile::Builder::new().prefix("dust-icons").tempdir().ok()
}
}
};
self.update_game_icon(config, _window);
Expand Down

0 comments on commit 9c52119

Please sign in to comment.