Skip to content

Commit 48aaf32

Browse files
committed
Fixed the most ciritical bug possible :/
1 parent 62e3403 commit 48aaf32

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

src-tauri/src/assets.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ impl Default for Settings {
5252
}
5353

5454
pub fn load_up_checks(data_dir_path: PathBuf) -> Result<(), Error> {
55+
create_dir_all(&data_dir_path)
56+
.map_err(|err: IoError| Error::directory("create", &data_dir_path, err))?;
5557
save_file(
5658
&data_dir_path.join("settings.json"),
5759
to_value(Settings::default())?,

src-tauri/src/errors.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,11 @@ pub enum Error {
2525
}
2626

2727
impl Error {
28-
pub fn directory(action: &str, path: &str, err: IoError) -> Self {
29-
Self::DirectoryOperation(format!("Failed to {action} the directory {path}: {err}"))
28+
pub fn directory(action: &str, path: impl AsRef<Path>, err: IoError) -> Self {
29+
Self::DirectoryOperation(format!(
30+
"Failed to {action} the directory {}: {err}",
31+
path.as_ref().to_string_lossy().to_string()
32+
))
3033
}
3134
pub fn file(action: &str, path: impl AsRef<Path>, err: IoError) -> Self {
3235
Self::FileOperation(format!(

src/utils/assets.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -130,12 +130,10 @@ export const startUp = async () => {
130130
setter(data);
131131
})
132132
);
133-
(async () => {
134-
const response = await getModules();
135-
useModulesStore
136-
.getState()
137-
.setModules(response.map((module) => ({ ...module, selected: true })));
138-
})();
133+
const response = await getModules();
134+
useModulesStore
135+
.getState()
136+
.setModules(response.map((module) => ({ ...module, selected: true })));
139137
if (!useSettingsStore.getState().settings.download_path)
140138
toggleModal("browse-modal", true);
141139
const storeConfigs = [

0 commit comments

Comments
 (0)