remove redundant option

This commit is contained in:
SpikeHD
2022-07-13 18:15:32 -07:00
parent b903c27a22
commit fd87adc1f6
4 changed files with 5 additions and 41 deletions

View File

@@ -19,7 +19,6 @@ interface IProps {
interface IState { interface IState {
game_install_path: string; game_install_path: string;
game_executable: string;
grasscutter_path: string; grasscutter_path: string;
java_path: string; java_path: string;
grasscutter_with_game: boolean; grasscutter_with_game: boolean;
@@ -37,7 +36,6 @@ export default class Options extends React.Component<IProps, IState> {
this.state = { this.state = {
game_install_path: '', game_install_path: '',
game_executable: '',
grasscutter_path: '', grasscutter_path: '',
java_path: '', java_path: '',
grasscutter_with_game: false, grasscutter_with_game: false,
@@ -49,7 +47,6 @@ export default class Options extends React.Component<IProps, IState> {
encryption: false, encryption: false,
} }
this.setGamePath = this.setGamePath.bind(this)
this.setGameExecutable = this.setGameExecutable.bind(this) this.setGameExecutable = this.setGameExecutable.bind(this)
this.setGrasscutterJar = this.setGrasscutterJar.bind(this) this.setGrasscutterJar = this.setGrasscutterJar.bind(this)
this.setJavaPath = this.setJavaPath.bind(this) this.setJavaPath = this.setJavaPath.bind(this)
@@ -69,7 +66,6 @@ export default class Options extends React.Component<IProps, IState> {
this.setState({ this.setState({
game_install_path: config.game_install_path || '', game_install_path: config.game_install_path || '',
game_executable: config.game_executable || '',
grasscutter_path: config.grasscutter_path || '', grasscutter_path: config.grasscutter_path || '',
java_path: config.java_path || '', java_path: config.java_path || '',
grasscutter_with_game: config.grasscutter_with_game || false, grasscutter_with_game: config.grasscutter_with_game || false,
@@ -84,7 +80,7 @@ export default class Options extends React.Component<IProps, IState> {
this.forceUpdate() this.forceUpdate()
} }
setGamePath(value: string) { setGameExecutable(value: string) {
setConfigOption('game_install_path', value) setConfigOption('game_install_path', value)
this.setState({ this.setState({
@@ -92,24 +88,6 @@ export default class Options extends React.Component<IProps, IState> {
}) })
} }
setGameExecutable(value: string) {
if (this.state.game_install_path != '') {
if (value.includes(this.state.game_install_path)) {
value = value.replace(this.state.game_install_path + '\\', '')
setConfigOption('game_executable', value)
this.setState({
game_executable: value,
})
} else {
alert('Game executable must be inside the game folder!')
}
} else {
alert('Please set the game install path first!')
}
}
setGrasscutterJar(value: string) { setGrasscutterJar(value: string) {
setConfigOption('grasscutter_path', value) setConfigOption('grasscutter_path', value)
@@ -199,15 +177,7 @@ export default class Options extends React.Component<IProps, IState> {
<Tr text="options.game_path" /> <Tr text="options.game_path" />
</div> </div>
<div className="OptionValue" id="menuOptionsDirGamePath"> <div className="OptionValue" id="menuOptionsDirGamePath">
<DirInput onChange={this.setGamePath} value={this.state?.game_install_path} folder={true} /> <DirInput onChange={this.setGameExecutable} value={this.state?.game_install_path} extensions={['exe']} />
</div>
</div>
<div className="OptionSection" id="menuOptionsContainerGameExecutable">
<div className="OptionLabel" id="menuOptionsLabelGameExecutable">
<Tr text="options.game_executable" />
</div>
<div className="OptionValue" id="menuOptionsDirGameExecutable">
<DirInput onChange={this.setGameExecutable} value={this.state?.game_executable} folder={false} extensions={['exe']} openFolder={this.state?.game_install_path} />
</div> </div>
</div> </div>
<div className="OptionSection" id="menuOptionsContainerGCJar"> <div className="OptionSection" id="menuOptionsContainerGCJar">

View File

@@ -7,8 +7,7 @@ let defaultConfig: Configuration
(async() => { (async() => {
defaultConfig = { defaultConfig = {
toggle_grasscutter: false, toggle_grasscutter: false,
game_install_path: 'C:\\Program Files\\Genshin Impact\\Genshin Impact game', game_install_path: 'C:\\Program Files\\Genshin Impact\\Genshin Impact game\\GenshinImpact.exe',
game_executable: 'GenshinImpact.exe',
grasscutter_with_game: false, grasscutter_with_game: false,
grasscutter_path: '', grasscutter_path: '',
java_path: '', java_path: '',
@@ -31,7 +30,6 @@ let defaultConfig: Configuration
export interface Configuration { export interface Configuration {
toggle_grasscutter: boolean toggle_grasscutter: boolean
game_install_path: string game_install_path: string
game_executable: string
grasscutter_with_game: boolean grasscutter_with_game: boolean
grasscutter_path: string grasscutter_path: string
java_path: string java_path: string

View File

@@ -7,6 +7,6 @@ export async function getGameExecutable() {
return null return null
} }
const pathArr = config.game_executable.replace(/\\/g, '/').split('/') const pathArr = config.game_install_path.replace(/\\/g, '/').split('/')
return pathArr[pathArr.length - 1].replace('.exe', '') return pathArr[pathArr.length - 1].replace('.exe', '')
} }

View File

@@ -9,8 +9,7 @@ export async function patchMetadata() {
}) })
if (!metadataExists) { if (!metadataExists) {
alert('Global metadata not found!') return false
return
} }
console.log('Copying unpatched metadata to backup location') console.log('Copying unpatched metadata to backup location')
@@ -23,7 +22,6 @@ export async function patchMetadata() {
}) })
if (!copiedMeta) { if (!copiedMeta) {
alert('Failed to backup metadata!')
console.log(await getBackupMetadataPath()) console.log(await getBackupMetadataPath())
return false return false
} }
@@ -37,7 +35,6 @@ export async function patchMetadata() {
}) })
if (!patchedMeta) { if (!patchedMeta) {
alert('Failed to patch metadata!')
return false return false
} }
@@ -51,7 +48,6 @@ export async function patchMetadata() {
}) })
if (!replacedMeta) { if (!replacedMeta) {
alert('Failed to replace game metadata!')
return false return false
} }