Skip to content

Commit

Permalink
Merge pull request #104 from gorilla-devs/develop
Browse files Browse the repository at this point in the history
Bugfixes for macOS v0.8.8 PR
  • Loading branch information
blarfoon authored Nov 14, 2018
2 parents e2baba5 + 7312c36 commit ee1f4c7
Show file tree
Hide file tree
Showing 9 changed files with 40 additions and 33 deletions.
24 changes: 15 additions & 9 deletions app/actions/instancesManager.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { message } from 'antd';
import log from 'electron-log';
import { exec } from 'child_process';
import path from 'path';
import launchCommand from '../utils/MCLaunchCommand';
import { PACKS_PATH } from '../constants';

export const SELECT_INSTANCE = 'SELECT_INSTANCE';
export const START_INSTANCE = 'START_INSTANCE';
Expand All @@ -25,7 +27,7 @@ export function selectInstanceNullable(name) {
}

export function selectInstance(name) {
return (dispatch) => {
return dispatch => {
dispatch({
type: SELECT_INSTANCE,
payload: name
Expand All @@ -36,14 +38,18 @@ export function selectInstance(name) {
export function startInstance(instanceName) {
return async (dispatch, getState) => {
const { auth } = getState();
const start = exec(await launchCommand(instanceName, auth), (error, stdout, stderr) => {
if (error) {
console.error(`exec error: ${error}`);
return;
const start = exec(
await launchCommand(instanceName, auth),
{ cwd: path.join(PACKS_PATH, instanceName) },
(error, stdout, stderr) => {
if (error) {
console.error(`exec error: ${error}`);
return;
}
console.log(`stdout: ${stdout}`);
console.log(`stderr: ${stderr}`);
}
console.log(`stdout: ${stdout}`);
console.log(`stderr: ${stderr}`);
});
);
dispatch({
type: START_INSTANCE,
payload: instanceName,
Expand All @@ -55,7 +61,7 @@ export function startInstance(instanceName) {
payload: instanceName
});
});
start.on('error', (err) => {
start.on('error', err => {
message.error('There was an error while starting the instance');
log.error(err);
});
Expand Down
2 changes: 1 addition & 1 deletion app/components/DInstance/DInstance.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,11 @@ export default class DInstance extends Component<Props> {
selectInstance(null);
message.success('Instance deleted');
} catch (err) {
hideMenu(`contextMenu-${name}`);
message.error('Error deleting instance');
log.error(err);
} finally {
this.setState({ deleting: false });
hideMenu(`contextMenu-${name}`);
}
};

Expand Down
8 changes: 4 additions & 4 deletions app/components/Home/Home.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,9 @@ export default class Home extends Component<Props> {
marginTop: 15,
textAlign: 'center'
}}
title="Try out the new v1.13.1"
title="Try out the new v1.13.2"
>
V1.13.1 has just been released. Wanna try it out?
V1.13.2 has just been released. Wanna try it out?
{this.state.latestBtnClicked || this.state.latestInstalled ? (
<Link
to="/dmanager"
Expand All @@ -137,11 +137,11 @@ export default class Home extends Component<Props> {
loading={this.props.packCreationLoading}
style={{ display: 'block', margin: '35px auto' }}
onClick={() => {
this.props.createPack('1.13.1', '1.13.1');
this.props.createPack('1.13.2', '1.13.2');
this.setState({ latestBtnClicked: true });
}}
>
Install and Start v1.13.1
Install and Start v1.13.2
</Button>
)}
</Card>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
import React, { Component } from 'react';
import { connect } from 'react-redux';
import Link from 'react-router-dom/Link';
import axios from 'axios';
import ContentLoader from 'react-content-loader';
import path from 'path';
import log from 'electron-log';
import Promise from 'bluebird';
import _ from 'lodash';
import { List, Avatar, Button, Input, Select, Icon, Popover } from 'antd';
import { Button, Select } from 'antd';
import { PACKS_PATH, CURSEMETA_API_URL } from '../../../../constants';
import { downloadFile } from '../../../../utils/downloader';
import { numberToRoundedWord } from '../../../../utils/numbers';

import styles from './ModPage.scss';

Expand Down Expand Up @@ -86,18 +84,20 @@ class ModPage extends Component<Props> {
};

getAddonData = async addon => {
const { data } = await axios.get(
`${CURSEMETA_API_URL}/direct/addon/${addon}`
);
const [{ data }, files] = await Promise.all([
axios.get(`${CURSEMETA_API_URL}/direct/addon/${addon}`),
axios.get(`${CURSEMETA_API_URL}/direct/addon/${addon}/files`)
]);

const files = (await axios.get(
`${CURSEMETA_API_URL}/direct/addon/${addon}/files`
)).data.filter(el =>
const filteredFiles = files.data.filter(el =>
el.gameVersion.includes(this.props.match.params.version)
);

this.setState({
data: { ...data, allFiles: _.orderBy(files, ['fileDate'], ['desc']) }
data: {
...data,
allFiles: _.orderBy(filteredFiles, ['fileDate'], ['desc'])
}
});
};

Expand Down Expand Up @@ -219,8 +219,8 @@ class ModPage extends Component<Props> {
{this.isInstalling(this.state.selectedVersion)
? 'Installing'
: this.isDownloadCompleted(this.state.selectedVersion)
? 'Installed'
: 'Install Selected Mod'}
? 'Installed'
: 'Install Selected Mod'}
</Button>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion app/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const CURSEFORGE_MODLOADERS_API =
'https://modloaders.cursecdn.com/647622546/maven';
export const NEWS_URL =
'https://minecraft.net/en-us/api/tiles/channel/not_set,Community%20content/region/None/category/Culture,Insider,News/page/1';
export const JAVA_URL = 'https://java.com/download';
export const JAVA_URL = 'https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html';
export const UPDATE_URL =
'https://raw.githubusercontent.com/gorilla-devs/GDLauncher/master/package.json';
export const THEMES = {
Expand Down
2 changes: 1 addition & 1 deletion app/utils/MCLaunchCommand.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const getMCArguments = (vanilla, forge, packName, userData) => {
return Arguments
.replace('${auth_player_name}', userData.displayName)
.replace('${auth_session}', userData.accessToken) // Legacy check for really old versions
.replace('${game_directory}', path.join(PACKS_PATH, packName))
.replace('${game_directory}', `"${path.join(PACKS_PATH, packName)}"`)
.replace('${game_assets}', path.join(INSTANCES_PATH, 'assets', vanilla.assets === 'legacy' ? '/virtual/legacy' : '')) // Another check for really old versions
.replace('${version_name}', forge !== null ? forge.versionInfo.id : vanilla.id)
.replace('${assets_root}', path.join(INSTANCES_PATH, 'assets', vanilla.assets === 'legacy' ? '/virtual/legacy' : ''))
Expand Down
3 changes: 2 additions & 1 deletion app/utils/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import launchCommand from './MCLaunchCommand';
import store from '../localStore';

const parseCLI = async (data, callback) => {
const instanceName = (minimist(data.slice(1)).i).toString();
// toString is used if the instance name is a number (1132) or other values different from a string
const instanceName = minimist(data.slice(1)).i.toString();
const auth = store.get('user');
const start = exec(
await launchCommand(instanceName, auth),
Expand Down
4 changes: 2 additions & 2 deletions app/utils/javaLocationFinder.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ const findJavaHome = async () => {
switch (os.platform()) {
case LINUX:
case DARWIN:
command = 'which javaw';
command = 'which java';
break;
case WINDOWS:
command = 'where javaw';
command = 'where java';
break;
default:
break;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "gdlauncher",
"productName": "GDLauncher",
"main": "./app/main.prod.js",
"version": "0.8.7",
"version": "0.8.8",
"description": "GDLauncher is simple, yet powerful Minecraft custom launcher with a strong focus on the user experience",
"scripts": {
"build": "yarn build-antd && concurrently \"yarn build-main\" \"yarn build-renderer\"",
Expand Down

0 comments on commit ee1f4c7

Please sign in to comment.