Created delete instance button, and made minor ui modifications
This commit is contained in:
parent
3b6aa14082
commit
ce24c0a55d
@ -174,7 +174,7 @@ func (i *InstanceManager) InstallModpack(modpack Modpack, instanceName string) {
|
|||||||
data, _ := json.Marshal(instance)
|
data, _ := json.Marshal(instance)
|
||||||
f.Write(data)
|
f.Write(data)
|
||||||
i.checkJavaVersion(instance)
|
i.checkJavaVersion(instance)
|
||||||
|
i.SearchInstances()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (i *InstanceManager) InstallVanilla(version string, instanceName string) {
|
func (i *InstanceManager) InstallVanilla(version string, instanceName string) {
|
||||||
@ -232,8 +232,7 @@ func (i *InstanceManager) InstallVanilla(version string, instanceName string) {
|
|||||||
i.app.Status(fmt.Sprintf("Installing Java Version %d", instance.JavaVersion))
|
i.app.Status(fmt.Sprintf("Installing Java Version %d", instance.JavaVersion))
|
||||||
i.app.Java.InstallJavaVer(instance.JavaVersion)
|
i.app.Java.InstallJavaVer(instance.JavaVersion)
|
||||||
}
|
}
|
||||||
|
i.SearchInstances()
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (i *InstanceManager) GetInstances() []string {
|
func (i *InstanceManager) GetInstances() []string {
|
||||||
@ -297,7 +296,7 @@ func (i *InstanceManager) LaunchInstance(instance string) {
|
|||||||
execName := "java"
|
execName := "java"
|
||||||
suffix := "lin"
|
suffix := "lin"
|
||||||
if runtime.GOOS == "windows" {
|
if runtime.GOOS == "windows" {
|
||||||
execName = "Java.exe"
|
execName = "Javaw.exe"
|
||||||
suffix = "win"
|
suffix = "win"
|
||||||
}
|
}
|
||||||
dir = filepath.Join(dir, "FCLauncher")
|
dir = filepath.Join(dir, "FCLauncher")
|
||||||
@ -605,7 +604,6 @@ func (i *InstanceManager) ImportMrpack(data io.Reader, name string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (i *InstanceManager) OpenInstanceFolder(instance string) {
|
func (i *InstanceManager) OpenInstanceFolder(instance string) {
|
||||||
i.app.Status("Installing Fabric")
|
|
||||||
_, err := i.GetInstance(instance)
|
_, err := i.GetInstance(instance)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Printf("Instance does not exist\n")
|
fmt.Printf("Instance does not exist\n")
|
||||||
@ -613,3 +611,14 @@ func (i *InstanceManager) OpenInstanceFolder(instance string) {
|
|||||||
dir, _ := os.UserConfigDir()
|
dir, _ := os.UserConfigDir()
|
||||||
openbrowser(filepath.Join(dir, "FCLauncher", "instances", instance, "minecraft"))
|
openbrowser(filepath.Join(dir, "FCLauncher", "instances", instance, "minecraft"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (i *InstanceManager) DeleteInstance(instance string) {
|
||||||
|
_, err := i.GetInstance(instance)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Printf("Instance does not exist\n")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
dir, _ := os.UserConfigDir()
|
||||||
|
os.RemoveAll(filepath.Join(dir, "FCLauncher", "instances", instance))
|
||||||
|
i.SearchInstances()
|
||||||
|
}
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import {instances, loading, navMargin} from './global'
|
import {instances, loading, navMargin} from './global'
|
||||||
import {OpenInstanceFolder, InstallVanilla, LaunchInstance, GetInstances, InstallForge, InstallQuilt, InstallFabric, CheckUpdate} from '../wailsjs/go/main/InstanceManager.js'
|
import {OpenInstanceFolder, InstallVanilla, LaunchInstance, GetInstances, InstallForge, InstallQuilt, InstallFabric, CheckUpdate, DeleteInstance} from '../wailsjs/go/main/InstanceManager.js'
|
||||||
import {GetVersions} from '../wailsjs/go/main/App.js'
|
import {GetVersions} from '../wailsjs/go/main/App.js'
|
||||||
import {onMount, createEventDispatcher} from 'svelte'
|
import {onMount, createEventDispatcher} from 'svelte'
|
||||||
var testArray = ["test","test2","test3"];
|
var testArray = ["test","test2","test3"];
|
||||||
|
export let UpdateInstances
|
||||||
|
|
||||||
let pack: string = "";
|
let pack: string = "";
|
||||||
let instance: string
|
let instance: string
|
||||||
@ -30,6 +31,16 @@ import {onMount, createEventDispatcher} from 'svelte'
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function deleteclick() {
|
||||||
|
$loading = true
|
||||||
|
DeleteInstance(radio).then(() => {
|
||||||
|
GetInstances().then((result) => {
|
||||||
|
$instances = result
|
||||||
|
$loading = false
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
@ -52,8 +63,9 @@ import {onMount, createEventDispatcher} from 'svelte'
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="options-container">
|
<div class="options-container">
|
||||||
<button class="launch-button" on:click={launchclick}>Launch {radio}</button>
|
<button class="instance-button" disabled='{radio == ""}' on:click={launchclick}>Launch {radio}</button>
|
||||||
<button class="option-button" on:click={() => {OpenInstanceFolder(radio)}}>Open Instance Folder</button>
|
<button class="instance-button" disabled='{radio == ""}' on:click={() => {OpenInstanceFolder(radio)}}>Open Instance Folder</button>
|
||||||
|
<button class="instance-button" disabled='{radio == ""}' on:click={deleteclick}>Delete Instance</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -107,7 +119,7 @@ main{
|
|||||||
margin-top: 15rem;
|
margin-top: 15rem;
|
||||||
gap: 10px;
|
gap: 10px;
|
||||||
}
|
}
|
||||||
.launch-button{
|
.instance-button{
|
||||||
min-height: 3rem;
|
min-height: 3rem;
|
||||||
border:solid;
|
border:solid;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
@ -118,29 +130,16 @@ main{
|
|||||||
max-width: 10rem;
|
max-width: 10rem;
|
||||||
max-height: fit-content;
|
max-height: fit-content;
|
||||||
}
|
}
|
||||||
.launch-button:hover{
|
.instance-button:hover:enabled{
|
||||||
color: var(--text-secondary);
|
color: var(--text-secondary);
|
||||||
}
|
}
|
||||||
.launch-button:active{
|
.instance-button:active:enabled{
|
||||||
opacity: 0.6;
|
opacity: 0.6;
|
||||||
}
|
}
|
||||||
.option-button{
|
.instance-button:disabled{
|
||||||
min-height: 3rem;
|
|
||||||
border:solid;
|
|
||||||
border-radius: 4px;
|
|
||||||
background-color: var(--bg-secondary);
|
|
||||||
border-color: var(--bg-secondary);
|
|
||||||
color: var(--text-primary);
|
|
||||||
font-size: medium;
|
|
||||||
max-width: 10rem;
|
|
||||||
max-height: fit-content;
|
|
||||||
}
|
|
||||||
.option-button:hover{
|
|
||||||
color: var(--text-secondary);
|
|
||||||
}
|
|
||||||
.option-button:active{
|
|
||||||
opacity: 0.6;
|
opacity: 0.6;
|
||||||
}
|
}
|
||||||
|
|
||||||
.container{
|
.container{
|
||||||
display: flex;
|
display: flex;
|
||||||
min-height: fit-content;
|
min-height: fit-content;
|
||||||
|
@ -5,6 +5,8 @@ import {io} from '../models';
|
|||||||
|
|
||||||
export function CheckUpdate(arg1:main.Instance):Promise<void>;
|
export function CheckUpdate(arg1:main.Instance):Promise<void>;
|
||||||
|
|
||||||
|
export function DeleteInstance(arg1:string):Promise<void>;
|
||||||
|
|
||||||
export function GetInstance(arg1:string):Promise<main.Instance>;
|
export function GetInstance(arg1:string):Promise<main.Instance>;
|
||||||
|
|
||||||
export function GetInstances():Promise<Array<string>>;
|
export function GetInstances():Promise<Array<string>>;
|
||||||
|
@ -6,6 +6,10 @@ export function CheckUpdate(arg1) {
|
|||||||
return window['go']['main']['InstanceManager']['CheckUpdate'](arg1);
|
return window['go']['main']['InstanceManager']['CheckUpdate'](arg1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function DeleteInstance(arg1) {
|
||||||
|
return window['go']['main']['InstanceManager']['DeleteInstance'](arg1);
|
||||||
|
}
|
||||||
|
|
||||||
export function GetInstance(arg1) {
|
export function GetInstance(arg1) {
|
||||||
return window['go']['main']['InstanceManager']['GetInstance'](arg1);
|
return window['go']['main']['InstanceManager']['GetInstance'](arg1);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user