fix(theseus): Correctly open/highlight folders (#2180)
This commit is contained in:
parent
bb3ce9fbc6
commit
6f956e0423
@ -10,8 +10,12 @@ export async function getOS() {
|
|||||||
return await invoke('plugin:utils|get_os')
|
return await invoke('plugin:utils|get_os')
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function showInFolder(path) {
|
export async function openPath(path) {
|
||||||
return await invoke('plugin:utils|show_in_folder', { path })
|
return await invoke('plugin:utils|open_path', { path })
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function highlightInFolder(path) {
|
||||||
|
return await invoke('plugin:utils|highlight_in_folder', { path })
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function showLauncherLogsFolder() {
|
export async function showLauncherLogsFolder() {
|
||||||
@ -21,12 +25,12 @@ export async function showLauncherLogsFolder() {
|
|||||||
// Opens a profile's folder in the OS file explorer
|
// Opens a profile's folder in the OS file explorer
|
||||||
export async function showProfileInFolder(path) {
|
export async function showProfileInFolder(path) {
|
||||||
const fullPath = await get_full_path(path)
|
const fullPath = await get_full_path(path)
|
||||||
return await showInFolder(fullPath)
|
return await openPath(fullPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function highlightModInProfile(profilePath, projectPath) {
|
export async function highlightModInProfile(profilePath, projectPath) {
|
||||||
const fullPath = await get_mod_full_path(profilePath, projectPath)
|
const fullPath = await get_mod_full_path(profilePath, projectPath)
|
||||||
return await showInFolder(fullPath)
|
return await highlightInFolder(fullPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
export const releaseColor = (releaseType) => {
|
export const releaseColor = (releaseType) => {
|
||||||
|
|||||||
@ -13,7 +13,8 @@ pub fn init<R: tauri::Runtime>() -> tauri::plugin::TauriPlugin<R> {
|
|||||||
.invoke_handler(tauri::generate_handler![
|
.invoke_handler(tauri::generate_handler![
|
||||||
get_os,
|
get_os,
|
||||||
should_disable_mouseover,
|
should_disable_mouseover,
|
||||||
show_in_folder,
|
highlight_in_folder,
|
||||||
|
open_path,
|
||||||
show_launcher_logs_folder,
|
show_launcher_logs_folder,
|
||||||
progress_bars_list,
|
progress_bars_list,
|
||||||
get_opening_command
|
get_opening_command
|
||||||
@ -72,11 +73,20 @@ pub async fn should_disable_mouseover() -> bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[tauri::command]
|
#[tauri::command]
|
||||||
pub fn show_in_folder(path: PathBuf) {
|
pub fn highlight_in_folder(path: PathBuf) {
|
||||||
let res = opener::reveal(path);
|
let res = opener::reveal(path);
|
||||||
|
|
||||||
if let Err(e) = res {
|
if let Err(e) = res {
|
||||||
tracing::error!("Failed to open folder: {}", e);
|
tracing::error!("Failed to highlight file in folder: {}", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[tauri::command]
|
||||||
|
pub fn open_path(path: PathBuf) {
|
||||||
|
let res = opener::open(path);
|
||||||
|
|
||||||
|
if let Err(e) = res {
|
||||||
|
tracing::error!("Failed to open path: {}", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -85,7 +95,7 @@ pub fn show_launcher_logs_folder() {
|
|||||||
let path = DirectoryInfo::launcher_logs_dir().unwrap_or_default();
|
let path = DirectoryInfo::launcher_logs_dir().unwrap_or_default();
|
||||||
// failure to get folder just opens filesystem
|
// failure to get folder just opens filesystem
|
||||||
// (ie: if in debug mode only and launcher_logs never created)
|
// (ie: if in debug mode only and launcher_logs never created)
|
||||||
show_in_folder(path);
|
open_path(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get opening command
|
// Get opening command
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user