You've already forked AstralRinth
forked from didirus/AstralRinth
Exports (#135)
* Initial bug fixes * fix compile error on non-mac * Fix even more bugs * Fix more * fix more * fix build * fix build * working basic * removed zip * working functions * merge fixes * fixed loadintg bar bug * changed to one layer deep * forge version numbers * overrides dont include mrpack * merge * fixes * fixes * fixed deletion * merge errors * force sync before export * removed testing * missed line * removed console log * mac error reverted --------- Co-authored-by: Jai A <jaiagr+gpg@pm.me>
This commit is contained in:
@@ -134,6 +134,42 @@ pub async fn profile_remove_project(
|
||||
profile::remove_project(path, project_path).await?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
// Exports a profile to a .mrpack file (export_location should end in .mrpack)
|
||||
// invoke('profile_export_mrpack')
|
||||
#[tauri::command]
|
||||
pub async fn profile_export_mrpack(
|
||||
path: &Path,
|
||||
export_location: PathBuf,
|
||||
included_overrides: Vec<String>,
|
||||
version_id: Option<String>,
|
||||
) -> Result<()> {
|
||||
profile::export_mrpack(
|
||||
path,
|
||||
export_location,
|
||||
included_overrides,
|
||||
version_id,
|
||||
)
|
||||
.await?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
// Given a folder path, populate a Vec of all the subfolders
|
||||
// Intended to be used for finding potential override folders
|
||||
// profile
|
||||
// -- folder1
|
||||
// -- folder2
|
||||
// -- file1
|
||||
// => [folder1, folder2]
|
||||
#[tauri::command]
|
||||
pub async fn profile_get_potential_override_folders(
|
||||
profile_path: PathBuf,
|
||||
) -> Result<Vec<PathBuf>> {
|
||||
let overrides =
|
||||
profile::get_potential_override_folders(profile_path).await?;
|
||||
Ok(overrides)
|
||||
}
|
||||
|
||||
// Run minecraft using a profile using the default credentials
|
||||
// Returns the UUID, which can be used to poll
|
||||
// for the actual Child in the state.
|
||||
|
||||
@@ -34,16 +34,15 @@ pub fn show_in_folder(path: String) -> Result<()> {
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
{
|
||||
use std::fs;
|
||||
use std::fs::metadata;
|
||||
use std::path::PathBuf;
|
||||
|
||||
if path.contains(",") {
|
||||
if path.contains(',') {
|
||||
// see https://gitlab.freedesktop.org/dbus/dbus/-/issues/76
|
||||
let new_path = match metadata(&path)?.is_dir() {
|
||||
true => path.clone(),
|
||||
true => path,
|
||||
false => {
|
||||
let mut path2 = PathBuf::from(path.clone());
|
||||
let mut path2 = PathBuf::from(path);
|
||||
path2.pop();
|
||||
path2.to_string_lossy().to_string()
|
||||
}
|
||||
|
||||
@@ -24,11 +24,7 @@ async fn initialize_state(app: tauri::AppHandle) -> api::Result<()> {
|
||||
|
||||
#[tauri::command]
|
||||
fn is_dev() -> bool {
|
||||
if cfg!(debug_assertions) {
|
||||
true
|
||||
} else {
|
||||
false
|
||||
}
|
||||
cfg!(debug_assertions)
|
||||
}
|
||||
|
||||
use tracing_subscriber::prelude::*;
|
||||
@@ -167,6 +163,8 @@ fn main() {
|
||||
api::jre::jre_get_jre,
|
||||
api::jre::jre_auto_install_java,
|
||||
api::jre::jre_get_max_memory,
|
||||
api::profile::profile_export_mrpack,
|
||||
api::profile::profile_get_potential_override_folders,
|
||||
api::process::process_get_all_uuids,
|
||||
api::process::process_get_all_running_uuids,
|
||||
api::process::process_get_uuids_by_profile_path,
|
||||
|
||||
@@ -49,8 +49,10 @@
|
||||
<h3 class="info-title">
|
||||
{{ loadingBar.title }}
|
||||
</h3>
|
||||
<ProgressBar :progress="Math.floor(loadingBar.current)" />
|
||||
<div class="row">{{ Math.floor(loadingBar.current) }}% {{ loadingBar.message }}</div>
|
||||
<ProgressBar :progress="Math.floor((100 * loadingBar.current) / loadingBar.total)" />
|
||||
<div class="row">
|
||||
{{ Math.floor((100 * loadingBar.current) / loadingBar.total) }}% {{ loadingBar.message }}
|
||||
</div>
|
||||
</div>
|
||||
</Card>
|
||||
</transition>
|
||||
|
||||
@@ -89,6 +89,30 @@ export async function remove_project(path, projectPath) {
|
||||
return await invoke('profile_remove_project', { path, projectPath })
|
||||
}
|
||||
|
||||
// Export a profile to .mrpack
|
||||
/// included_overrides is an array of paths to override folders to include (ie: 'mods', 'resource_packs')
|
||||
// Version id is optional (ie: 1.1.5)
|
||||
export async function export_profile_mrpack(path, exportLocation, includedOverrides, versionId) {
|
||||
return await invoke('profile_export_mrpack', {
|
||||
path,
|
||||
exportLocation,
|
||||
includedOverrides,
|
||||
versionId,
|
||||
})
|
||||
}
|
||||
|
||||
// Given a folder path, populate an array of all the subfolders
|
||||
// Intended to be used for finding potential override folders
|
||||
// profile
|
||||
// -- mods
|
||||
// -- resourcepacks
|
||||
// -- file1
|
||||
// => [mods, resourcepacks]
|
||||
// allows selection for 'included_overrides' in export_profile_mrpack
|
||||
export async function get_potential_override_folders(profilePath) {
|
||||
return await invoke('profile_get_potential_override_folders', { profilePath })
|
||||
}
|
||||
|
||||
// Run Minecraft using a pathed profile
|
||||
// Returns PID of child
|
||||
export async function run(path) {
|
||||
|
||||
Reference in New Issue
Block a user