-
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
40 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,8 @@ yarn-error.log* | |
pnpm-debug.log* | ||
lerna-debug.log* | ||
|
||
.yarn/* | ||
|
||
node_modules | ||
dist | ||
dist-ssr | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,33 @@ | ||
use std::fs; | ||
use std::{fs, path::PathBuf}; | ||
|
||
use crate::helpers::resource_folder; | ||
use tauri::Manager; | ||
|
||
pub fn get_html(dir: &str) -> String { | ||
match fs::read_to_string(resource_folder().join(dir)) { | ||
pub fn get_html(app: tauri::AppHandle, dir: &str) -> String { | ||
let dir = app | ||
.path_resolver() | ||
.resolve_resource(PathBuf::from(dir)) | ||
.unwrap(); | ||
match fs::read_to_string(&dir) { | ||
Ok(f) => f, | ||
Err(e) => { | ||
println!("Failed to read {} in local dir: {}", dir, e); | ||
println!("Failed to read {:?} in local dir: {}", dir, e); | ||
|
||
String::new() | ||
} | ||
} | ||
} | ||
|
||
#[tauri::command] | ||
pub fn get_index() -> String { | ||
get_html("html/index.html") | ||
pub fn get_index(win: tauri::Window) -> String { | ||
get_html(win.app_handle(), "html/index.html") | ||
} | ||
|
||
#[tauri::command] | ||
pub fn get_top_bar() -> String { | ||
get_html("html/top.html") | ||
pub fn get_top_bar(win: tauri::Window) -> String { | ||
get_html(win.app_handle(), "html/top.html") | ||
} | ||
|
||
#[tauri::command] | ||
pub fn get_notif() -> String { | ||
get_html("html/notification.html") | ||
pub fn get_notif(win: tauri::Window) -> String { | ||
get_html(win.app_handle(), "html/notification.html") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters