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 react from '@vitejs/plugin-react'
import commonjsExternals from 'vite-plugin-commonjs-externals' import commonjsExternals from 'vite-plugin-commonjs-externals'
const externals = ['pimi-launcher-core', 'path'] const externals = ['pimi-launcher-core', 'path', 'process']
export default defineConfig({ export default defineConfig({
main: { main: {

View file

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

View file

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

View file

@ -49,11 +49,13 @@ function Main() {
name="pets" name="pets"
id="pet-select" id="pet-select"
className="inputs" className="inputs"
onChange={(e) => setVersion(e.target.value)} onChange={(e) => {
setVersion(versions[e.target.value])
}}
> >
{versions.map((version) => { {versions.map((version, index) => {
return ( 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} {version.id}
</option> </option>
) )