2024-07-24 11:03:19 -07:00
|
|
|
import { get_full_path, get_mod_full_path } from '@/helpers/profile'
|
2024-08-27 21:49:36 +02:00
|
|
|
import { invoke } from '@tauri-apps/api/core'
|
2023-06-02 07:09:46 -07:00
|
|
|
|
2023-06-19 14:59:06 -07:00
|
|
|
export async function isDev() {
|
|
|
|
|
return await invoke('is_dev')
|
|
|
|
|
}
|
|
|
|
|
|
2023-08-04 20:33:50 -07:00
|
|
|
// One of 'Windows', 'Linux', 'MacOS'
|
|
|
|
|
export async function getOS() {
|
|
|
|
|
return await invoke('plugin:utils|get_os')
|
|
|
|
|
}
|
|
|
|
|
|
2024-08-21 01:08:26 +02:00
|
|
|
export async function openPath(path) {
|
|
|
|
|
return await invoke('plugin:utils|open_path', { path })
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export async function highlightInFolder(path) {
|
|
|
|
|
return await invoke('plugin:utils|highlight_in_folder', { path })
|
2023-06-02 07:09:46 -07:00
|
|
|
}
|
2023-05-08 19:27:27 -04:00
|
|
|
|
2023-09-12 09:27:03 -07:00
|
|
|
export async function showLauncherLogsFolder() {
|
|
|
|
|
return await invoke('plugin:utils|show_launcher_logs_folder', {})
|
|
|
|
|
}
|
|
|
|
|
|
2023-07-28 19:56:49 -07:00
|
|
|
// Opens a profile's folder in the OS file explorer
|
|
|
|
|
export async function showProfileInFolder(path) {
|
|
|
|
|
const fullPath = await get_full_path(path)
|
2024-08-21 01:08:26 +02:00
|
|
|
return await openPath(fullPath)
|
2023-07-28 19:56:49 -07:00
|
|
|
}
|
|
|
|
|
|
2023-09-12 09:27:03 -07:00
|
|
|
export async function highlightModInProfile(profilePath, projectPath) {
|
|
|
|
|
const fullPath = await get_mod_full_path(profilePath, projectPath)
|
2024-08-21 01:08:26 +02:00
|
|
|
return await highlightInFolder(fullPath)
|
2023-09-12 09:27:03 -07:00
|
|
|
}
|
|
|
|
|
|
2024-08-30 10:42:58 -07:00
|
|
|
export async function restartApp() {
|
|
|
|
|
return await invoke('restart_app')
|
|
|
|
|
}
|
|
|
|
|
|
2023-04-06 21:06:37 -04:00
|
|
|
export const releaseColor = (releaseType) => {
|
|
|
|
|
switch (releaseType) {
|
|
|
|
|
case 'release':
|
|
|
|
|
return 'green'
|
|
|
|
|
case 'beta':
|
|
|
|
|
return 'orange'
|
|
|
|
|
case 'alpha':
|
|
|
|
|
return 'red'
|
|
|
|
|
default:
|
|
|
|
|
return ''
|
|
|
|
|
}
|
|
|
|
|
}
|