From 73abb1c3526d8899df94c629444bd3d0dd194980 Mon Sep 17 00:00:00 2001 From: Artemy Date: Tue, 20 Jun 2023 16:47:10 +0300 Subject: [PATCH] fix: version selection, path to data --- electron.vite.config.js | 2 +- package.json | 4 ++-- src/renderer/src/components/utils.js | 7 ++++--- src/renderer/src/pages/Main.jsx | 8 +++++--- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/electron.vite.config.js b/electron.vite.config.js index 7119cf9..56deae9 100644 --- a/electron.vite.config.js +++ b/electron.vite.config.js @@ -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: { diff --git a/package.json b/package.json index 473e689..8c5494e 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/renderer/src/components/utils.js b/src/renderer/src/components/utils.js index 25ff393..027503d 100644 --- a/src/renderer/src/components/utils.js +++ b/src/renderer/src/components/utils.js @@ -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 diff --git a/src/renderer/src/pages/Main.jsx b/src/renderer/src/pages/Main.jsx index 72bf37b..6164416 100644 --- a/src/renderer/src/pages/Main.jsx +++ b/src/renderer/src/pages/Main.jsx @@ -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 ( - )