fix: version selection, path to data

This commit is contained in:
Artemy 2023-06-20 16:47:10 +03:00
parent 63c9bbf2e6
commit 73abb1c352
4 changed files with 12 additions and 9 deletions

View file

@ -18,7 +18,7 @@ import { defineConfig, externalizeDepsPlugin } from 'electron-vite'
import react from '@vitejs/plugin-react'
import commonjsExternals from 'vite-plugin-commonjs-externals'
const externals = ['pimi-launcher-core', 'path']
const externals = ['pimi-launcher-core', 'path', 'process']
export default defineConfig({
main: {

View file

@ -1,7 +1,7 @@
{
"name": "pimi-launcher",
"version": "1.0.0",
"description": "An Electron application with React",
"version": "1.0.0-alpha",
"description": "Modern Minecraft Launcher",
"main": "./out/main/index.js",
"author": "artegoser",
"homepage": "https://github.com/artegoser/pimi-launcher",

View file

@ -1,7 +1,8 @@
import { Client, Authenticator } from 'pimi-launcher-core'
import path from 'path'
import process from 'process'
async function launch(version, setProgress, setDownload, setGameStarted, setStarted) {
console.log(version)
const appdata = process.platform === 'win32' ? process.env.APPDATA : process.env.HOME
const launcher = new Client()
let opts = {
@ -9,7 +10,7 @@ async function launch(version, setProgress, setDownload, setGameStarted, setStar
localStorage.getItem('name') || 'Steve',
localStorage.getItem('password') || ''
),
root: './.pimi',
root: path.join(appdata, '.pimi-launcher'),
version: {
number: version.id,
type: version.type

View file

@ -49,11 +49,13 @@ function Main() {
name="pets"
id="pet-select"
className="inputs"
onChange={(e) => setVersion(e.target.value)}
onChange={(e) => {
setVersion(versions[e.target.value])
}}
>
{versions.map((version) => {
{versions.map((version, index) => {
return (
<option key={version.id} value={version} className="text-1xl font-bold underline">
<option key={index} value={index} className="text-1xl font-bold underline">
{version.id}
</option>
)