You've already forked AstralRinth
forked from didirus/AstralRinth
* feat(theseus): Initial migration to Tauri v2 * feat(theseus): Added a way to zoom / scale UI * chore(theseus): Started cleaning up some plugins * fix(theseus): Github Actions * refactor(theseus): Reduced boilerplate & more work * feat(theseus): Allow multiple app instances to be open at once (#995) * fix(theseus): Lint & more * fix(theseus): App Release github action * fix(theseus): Open links in browser & macos builds * fix(theseus): Rebase fixes * fix(theseus): Updater & app release action * fix(theseus): Fixed definitions in `build.rs` * Fix MacOS deep linking, window decorations * fix(theseus): Closing & maximizing app * Fix macos build * add back release conf * acc fix build * make updater for release builds only * focus window on startup --------- Co-authored-by: Jai A <jaiagr+gpg@pm.me> Co-authored-by: Geometrically <18202329+Geometrically@users.noreply.github.com>
62 lines
1.6 KiB
JavaScript
62 lines
1.6 KiB
JavaScript
import { get_full_path, get_mod_full_path } from '@/helpers/profile'
|
|
import { invoke } from '@tauri-apps/api/core'
|
|
|
|
export async function isDev() {
|
|
return await invoke('is_dev')
|
|
}
|
|
|
|
// One of 'Windows', 'Linux', 'MacOS'
|
|
export async function getOS() {
|
|
return await invoke('plugin:utils|get_os')
|
|
}
|
|
|
|
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 })
|
|
}
|
|
|
|
export async function showLauncherLogsFolder() {
|
|
return await invoke('plugin:utils|show_launcher_logs_folder', {})
|
|
}
|
|
|
|
// Opens a profile's folder in the OS file explorer
|
|
export async function showProfileInFolder(path) {
|
|
const fullPath = await get_full_path(path)
|
|
return await openPath(fullPath)
|
|
}
|
|
|
|
export async function highlightModInProfile(profilePath, projectPath) {
|
|
const fullPath = await get_mod_full_path(profilePath, projectPath)
|
|
return await highlightInFolder(fullPath)
|
|
}
|
|
|
|
export const releaseColor = (releaseType) => {
|
|
switch (releaseType) {
|
|
case 'release':
|
|
return 'green'
|
|
case 'beta':
|
|
return 'orange'
|
|
case 'alpha':
|
|
return 'red'
|
|
default:
|
|
return ''
|
|
}
|
|
}
|
|
|
|
export function debounce(fn, wait) {
|
|
let timer
|
|
return function (...args) {
|
|
if (timer) {
|
|
clearTimeout(timer) // clear any pre-existing timer
|
|
}
|
|
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
const context = this // get the current context
|
|
timer = setTimeout(() => {
|
|
fn.apply(context, args) // call the function if time expires
|
|
}, wait)
|
|
}
|
|
}
|