mirror of
https://github.com/dscalzi/HeliosLauncher.git
synced 2024-12-22 11:42:14 -08:00
Added option to change data folder location. (#17)
Removed commonDirectory. Removed instanceDirectory. Added dataDirectory. The common and instance directories are now resolved from this. The config.json and distribution.json are now stored in Electron's data folder (app.getPath('userData')). Users can edit the dataDirectory under launcher settings.
This commit is contained in:
parent
e12197526d
commit
de15440e6d
@ -1092,8 +1092,9 @@ body, button {
|
|||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
margin: 20px 0px;
|
padding: 20px 0px;
|
||||||
width: 75%;
|
width: 75%;
|
||||||
|
border-bottom: 1px solid rgba(255, 255, 255, 0.50);
|
||||||
}
|
}
|
||||||
.settingsFieldLeft {
|
.settingsFieldLeft {
|
||||||
display: flex;
|
display: flex;
|
||||||
@ -1107,6 +1108,7 @@ body, button {
|
|||||||
.settingsFieldDesc {
|
.settingsFieldDesc {
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
color: rgba(255, 255, 255, .95);
|
color: rgba(255, 255, 255, .95);
|
||||||
|
margin-top: 5px;
|
||||||
}
|
}
|
||||||
.settingsDivider {
|
.settingsDivider {
|
||||||
height: 1px;
|
height: 1px;
|
||||||
@ -1187,6 +1189,93 @@ input:checked + .toggleSwitchSlider:before {
|
|||||||
cursor: ew-resize;
|
cursor: ew-resize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* File selectors */
|
||||||
|
|
||||||
|
/* Main container for File selectors. */
|
||||||
|
.settingsFileSelContainer {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
border-bottom: 1px solid rgba(255, 255, 255, 0.50);
|
||||||
|
margin-bottom: 20px;
|
||||||
|
margin-top: 20px;
|
||||||
|
width: 75%;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* File selector title. */
|
||||||
|
.settingsFileSelTitle {
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Wrapper container for the actionable elements. */
|
||||||
|
.settingsFileSelActions {
|
||||||
|
display: flex;
|
||||||
|
width: 90%;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* File selector icon settings. */
|
||||||
|
.settingsFileSelIcon {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
background: rgba(126, 126, 126, 0.57);
|
||||||
|
border-radius: 3px 0px 0px 3px;
|
||||||
|
padding: 5px;
|
||||||
|
transition: 0.25s ease;
|
||||||
|
}
|
||||||
|
.settingsFileSelSVG {
|
||||||
|
width: 20px;
|
||||||
|
height: 20px;
|
||||||
|
fill: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Disabled text field which stores the selected file path. */
|
||||||
|
.settingsFileSelVal {
|
||||||
|
border-radius: 0px !important;
|
||||||
|
width: 100%;
|
||||||
|
padding: 5px 10px;
|
||||||
|
font-size: 12px;
|
||||||
|
height: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* File input for file selection. */
|
||||||
|
.settingsFileSelSel {
|
||||||
|
width: 0px;
|
||||||
|
height: 0px;
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
.settingsFileSelSel::-webkit-file-upload-button {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Wrapper label to add a custom style to the file input. */
|
||||||
|
.settingsFileSelLabel {
|
||||||
|
border-left: 0px;
|
||||||
|
border-radius: 0px 3px 3px 0px;
|
||||||
|
font-size: 12px;
|
||||||
|
padding: 0px 5px;
|
||||||
|
cursor: pointer;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
background: rgba(126, 126, 126, 0.57);
|
||||||
|
transition: 0.25s ease;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
.settingsFileSelLabel:hover,
|
||||||
|
.settingsFileSelLabel:focus,
|
||||||
|
.settingsFileSelSel:focus ~ #settingsJavaExecLabel {
|
||||||
|
text-shadow: 0px 0px 20px white;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Description for the file selector. */
|
||||||
|
.settingsFileSelDesc {
|
||||||
|
font-size: 10px;
|
||||||
|
margin: 20px 0px;
|
||||||
|
color: lightgrey;
|
||||||
|
width: 89%;
|
||||||
|
}
|
||||||
|
.settingsFileSelDesc strong {
|
||||||
|
font-family: 'Avenir Medium';
|
||||||
|
}
|
||||||
|
|
||||||
/* * *
|
/* * *
|
||||||
* Settings View (Account Tab)
|
* Settings View (Account Tab)
|
||||||
* * */
|
* * */
|
||||||
@ -1347,7 +1436,9 @@ input:checked + .toggleSwitchSlider:before {
|
|||||||
#settingsGameResolutionContainer {
|
#settingsGameResolutionContainer {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
margin-bottom: 20px;
|
padding-bottom: 20px;
|
||||||
|
border-bottom: 1px solid rgba(255, 255, 255, 0.50);
|
||||||
|
width: 75%;
|
||||||
}
|
}
|
||||||
#settingsGameResolutionContent {
|
#settingsGameResolutionContent {
|
||||||
display: flex;
|
display: flex;
|
||||||
@ -1805,20 +1896,6 @@ input:checked + .toggleSwitchSlider:before {
|
|||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Main container for the Java executable setting. */
|
|
||||||
#settingsJavaExecContainer {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
border-bottom: 1px solid rgba(255, 255, 255, 0.50);
|
|
||||||
margin-bottom: 20px;
|
|
||||||
width: 75%;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Java executable setting title. */
|
|
||||||
#settingsJavaExecTitle {
|
|
||||||
margin-bottom: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Status text which displays details on the selected executable. */
|
/* Status text which displays details on the selected executable. */
|
||||||
#settingsJavaExecDetails {
|
#settingsJavaExecDetails {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
@ -1826,76 +1903,6 @@ input:checked + .toggleSwitchSlider:before {
|
|||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Wrapper container for the actionable elements. */
|
|
||||||
#settingsJavaExecActions {
|
|
||||||
display: flex;
|
|
||||||
width: 90%;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Java icon settings. */
|
|
||||||
.settingsJavaIcon {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
background: rgba(126, 126, 126, 0.57);
|
|
||||||
border-radius: 3px 0px 0px 3px;
|
|
||||||
padding: 5px;
|
|
||||||
transition: 0.25s ease;
|
|
||||||
}
|
|
||||||
.settingsJavaIconSVG {
|
|
||||||
width: 20px;
|
|
||||||
height: 20px;
|
|
||||||
fill: white;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Disabled text field which stores the selected executable path. */
|
|
||||||
#settingsJavaExecVal {
|
|
||||||
border-radius: 0px !important;
|
|
||||||
width: 100%;
|
|
||||||
padding: 5px 10px;
|
|
||||||
font-size: 12px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* File input for executable selection. */
|
|
||||||
#settingsJavaExecSel {
|
|
||||||
width: 0px;
|
|
||||||
height: 0px;
|
|
||||||
opacity: 0;
|
|
||||||
}
|
|
||||||
#settingsJavaExecSel::-webkit-file-upload-button {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Wrapper label to add a custom style to the file input. */
|
|
||||||
#settingsJavaExecLabel {
|
|
||||||
border-left: 0px;
|
|
||||||
border-radius: 0px 3px 3px 0px;
|
|
||||||
font-size: 12px;
|
|
||||||
padding: 0px 5px;
|
|
||||||
cursor: pointer;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
background: rgba(126, 126, 126, 0.57);
|
|
||||||
transition: 0.25s ease;
|
|
||||||
white-space: nowrap;
|
|
||||||
}
|
|
||||||
#settingsJavaExecLabel:hover,
|
|
||||||
#settingsJavaExecLabel:focus,
|
|
||||||
#settingsJavaExecSel:focus ~ #settingsJavaExecLabel {
|
|
||||||
text-shadow: 0px 0px 20px white;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Description for the Java executable setting. */
|
|
||||||
#settingsJavaExecDesc {
|
|
||||||
font-size: 10px;
|
|
||||||
margin: 20px 0px;
|
|
||||||
color: lightgrey;
|
|
||||||
font-weight: bold;
|
|
||||||
width: 89%;
|
|
||||||
}
|
|
||||||
#settingsJavaExecDesc strong {
|
|
||||||
font-family: 'Avenir Medium';
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Main container for the JVM options setting. */
|
/* Main container for the JVM options setting. */
|
||||||
#settingsJVMOptsContainer {
|
#settingsJVMOptsContainer {
|
||||||
width: 75%;
|
width: 75%;
|
||||||
@ -1932,6 +1939,15 @@ input:checked + .toggleSwitchSlider:before {
|
|||||||
width: 89%;
|
width: 89%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* * *
|
||||||
|
* Settings View (Launcher Tab)
|
||||||
|
* * */
|
||||||
|
|
||||||
|
/* Tailored style for the data directory header. */
|
||||||
|
#settingsDataDirTitle {
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
/* * *
|
/* * *
|
||||||
* Settings View (About Tab)
|
* Settings View (About Tab)
|
||||||
* * */
|
* * */
|
||||||
|
@ -1,13 +1,46 @@
|
|||||||
const fs = require('fs-extra')
|
const fs = require('fs-extra')
|
||||||
const os = require('os')
|
const os = require('os')
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
|
|
||||||
const logger = require('./loggerutil')('%c[ConfigManager]', 'color: #a02d2a; font-weight: bold')
|
const logger = require('./loggerutil')('%c[ConfigManager]', 'color: #a02d2a; font-weight: bold')
|
||||||
|
|
||||||
const sysRoot = process.env.APPDATA || (process.platform == 'darwin' ? process.env.HOME + '/Library/Application Support' : process.env.HOME)
|
const sysRoot = process.env.APPDATA || (process.platform == 'darwin' ? process.env.HOME + '/Library/Application Support' : process.env.HOME)
|
||||||
const dataPath = path.join(sysRoot, '.westeroscraft')
|
const dataPath = path.join(sysRoot, '.westeroscraft')
|
||||||
|
|
||||||
const firstLaunch = !fs.existsSync(dataPath)
|
// Forked processes do not have access to electron, so we have this workaround.
|
||||||
|
const launcherDir = process.env.CONFIG_DIRECT_PATH || require('electron').remote.app.getPath('userData')
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve the absolute path of the launcher directory.
|
||||||
|
*
|
||||||
|
* @returns {string} The absolute path of the launcher directory.
|
||||||
|
*/
|
||||||
|
exports.getLauncherDirectory = function(){
|
||||||
|
return launcherDir
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the launcher's data directory. This is where all files related
|
||||||
|
* to game launch are installed (common, instances, java, etc).
|
||||||
|
*
|
||||||
|
* @returns {string} The absolute path of the launcher's data directory.
|
||||||
|
*/
|
||||||
|
exports.getDataDirectory = function(def = false){
|
||||||
|
return !def ? config.settings.launcher.dataDirectory : DEFAULT_CONFIG.settings.launcher.dataDirectory
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the new data directory.
|
||||||
|
*
|
||||||
|
* @param {string} dataDirectory The new data directory.
|
||||||
|
*/
|
||||||
|
exports.setDataDirectory = function(dataDirectory){
|
||||||
|
config.settings.launcher.dataDirectory = dataDirectory
|
||||||
|
}
|
||||||
|
|
||||||
|
const configPath = path.join(exports.getLauncherDirectory(), 'config.json')
|
||||||
|
const configPathLEGACY = path.join(dataPath, 'config.json')
|
||||||
|
const firstLaunch = !fs.existsSync(configPath) && !fs.existsSync(configPathLEGACY)
|
||||||
|
|
||||||
exports.getAbsoluteMinRAM = function(){
|
exports.getAbsoluteMinRAM = function(){
|
||||||
const mem = os.totalmem()
|
const mem = os.totalmem()
|
||||||
@ -56,7 +89,8 @@ const DEFAULT_CONFIG = {
|
|||||||
launchDetached: true
|
launchDetached: true
|
||||||
},
|
},
|
||||||
launcher: {
|
launcher: {
|
||||||
allowPrerelease: false
|
allowPrerelease: false,
|
||||||
|
dataDirectory: dataPath
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
newsCache: {
|
newsCache: {
|
||||||
@ -64,8 +98,6 @@ const DEFAULT_CONFIG = {
|
|||||||
content: null,
|
content: null,
|
||||||
dismissed: false
|
dismissed: false
|
||||||
},
|
},
|
||||||
commonDirectory: path.join(dataPath, 'common'),
|
|
||||||
instanceDirectory: path.join(dataPath, 'instances'),
|
|
||||||
clientToken: null,
|
clientToken: null,
|
||||||
selectedServer: null, // Resolved
|
selectedServer: null, // Resolved
|
||||||
selectedAccount: null,
|
selectedAccount: null,
|
||||||
@ -81,8 +113,7 @@ let config = null
|
|||||||
* Save the current configuration to a file.
|
* Save the current configuration to a file.
|
||||||
*/
|
*/
|
||||||
exports.save = function(){
|
exports.save = function(){
|
||||||
const filePath = path.join(dataPath, 'config.json')
|
fs.writeFileSync(configPath, JSON.stringify(config, null, 4), 'UTF-8')
|
||||||
fs.writeFileSync(filePath, JSON.stringify(config, null, 4), 'UTF-8')
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -92,24 +123,29 @@ exports.save = function(){
|
|||||||
* need to be externally assigned.
|
* need to be externally assigned.
|
||||||
*/
|
*/
|
||||||
exports.load = function(){
|
exports.load = function(){
|
||||||
// Determine the effective configuration.
|
let doLoad = true
|
||||||
const filePath = path.join(dataPath, 'config.json')
|
|
||||||
|
|
||||||
if(!fs.existsSync(filePath)){
|
if(!fs.existsSync(configPath)){
|
||||||
// Create all parent directories.
|
// Create all parent directories.
|
||||||
fs.ensureDirSync(path.join(filePath, '..'))
|
fs.ensureDirSync(path.join(configPath, '..'))
|
||||||
config = DEFAULT_CONFIG
|
if(fs.existsSync(configPathLEGACY)){
|
||||||
exports.save()
|
fs.moveSync(configPathLEGACY, configPath)
|
||||||
} else {
|
} else {
|
||||||
|
doLoad = false
|
||||||
|
config = DEFAULT_CONFIG
|
||||||
|
exports.save()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(doLoad){
|
||||||
let doValidate = false
|
let doValidate = false
|
||||||
try {
|
try {
|
||||||
config = JSON.parse(fs.readFileSync(filePath, 'UTF-8'))
|
config = JSON.parse(fs.readFileSync(configPath, 'UTF-8'))
|
||||||
doValidate = true
|
doValidate = true
|
||||||
} catch (err){
|
} catch (err){
|
||||||
logger.error(err)
|
logger.error(err)
|
||||||
logger.log('Configuration file contains malformed JSON or is corrupt.')
|
logger.log('Configuration file contains malformed JSON or is corrupt.')
|
||||||
logger.log('Generating a new configuration file.')
|
logger.log('Generating a new configuration file.')
|
||||||
fs.ensureDirSync(path.join(filePath, '..'))
|
fs.ensureDirSync(path.join(configPath, '..'))
|
||||||
config = DEFAULT_CONFIG
|
config = DEFAULT_CONFIG
|
||||||
exports.save()
|
exports.save()
|
||||||
}
|
}
|
||||||
@ -152,15 +188,6 @@ function validateKeySet(srcObj, destObj){
|
|||||||
return destObj
|
return destObj
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Retrieve the absolute path of the launcher directory.
|
|
||||||
*
|
|
||||||
* @returns {string} The absolute path of the launcher directory.
|
|
||||||
*/
|
|
||||||
exports.getLauncherDirectory = function(){
|
|
||||||
return dataPath
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check to see if this is the first time the user has launched the
|
* Check to see if this is the first time the user has launched the
|
||||||
* application. This is determined by the existance of the data path.
|
* application. This is determined by the existance of the data path.
|
||||||
@ -218,7 +245,7 @@ exports.setNewsCacheDismissed = function(dismissed){
|
|||||||
* @returns {string} The launcher's common directory.
|
* @returns {string} The launcher's common directory.
|
||||||
*/
|
*/
|
||||||
exports.getCommonDirectory = function(){
|
exports.getCommonDirectory = function(){
|
||||||
return config.commonDirectory
|
return path.join(exports.getDataDirectory(), 'common')
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -228,7 +255,7 @@ exports.getCommonDirectory = function(){
|
|||||||
* @returns {string} The launcher's instance directory.
|
* @returns {string} The launcher's instance directory.
|
||||||
*/
|
*/
|
||||||
exports.getInstanceDirectory = function(){
|
exports.getInstanceDirectory = function(){
|
||||||
return config.instanceDirectory
|
return path.join(exports.getDataDirectory(), 'instances')
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -275,11 +275,15 @@ function asyncSystemScan(mcVersion, launchAfter = true){
|
|||||||
|
|
||||||
const loggerSysAEx = LoggerUtil('%c[SysAEx]', 'color: #353232; font-weight: bold')
|
const loggerSysAEx = LoggerUtil('%c[SysAEx]', 'color: #353232; font-weight: bold')
|
||||||
|
|
||||||
|
const forkEnv = JSON.parse(JSON.stringify(process.env))
|
||||||
|
forkEnv.CONFIG_DIRECT_PATH = ConfigManager.getLauncherDirectory()
|
||||||
|
|
||||||
// Fork a process to run validations.
|
// Fork a process to run validations.
|
||||||
sysAEx = cp.fork(path.join(__dirname, 'assets', 'js', 'assetexec.js'), [
|
sysAEx = cp.fork(path.join(__dirname, 'assets', 'js', 'assetexec.js'), [
|
||||||
ConfigManager.getCommonDirectory(),
|
ConfigManager.getCommonDirectory(),
|
||||||
ConfigManager.getJavaExecutable()
|
ConfigManager.getJavaExecutable()
|
||||||
], {
|
], {
|
||||||
|
env: forkEnv,
|
||||||
stdio: 'pipe'
|
stdio: 'pipe'
|
||||||
})
|
})
|
||||||
// Stdout
|
// Stdout
|
||||||
@ -307,7 +311,7 @@ function asyncSystemScan(mcVersion, launchAfter = true){
|
|||||||
)
|
)
|
||||||
setOverlayHandler(() => {
|
setOverlayHandler(() => {
|
||||||
setLaunchDetails('Preparing Java Download..')
|
setLaunchDetails('Preparing Java Download..')
|
||||||
sysAEx.send({task: 'execute', function: '_enqueueOracleJRE', argsArr: [ConfigManager.getLauncherDirectory()]})
|
sysAEx.send({task: 'execute', function: '_enqueueOracleJRE', argsArr: [ConfigManager.getDataDirectory()]})
|
||||||
toggleOverlay(false)
|
toggleOverlay(false)
|
||||||
})
|
})
|
||||||
setDismissHandler(() => {
|
setDismissHandler(() => {
|
||||||
@ -431,7 +435,7 @@ function asyncSystemScan(mcVersion, launchAfter = true){
|
|||||||
|
|
||||||
// Begin system Java scan.
|
// Begin system Java scan.
|
||||||
setLaunchDetails('Checking system info..')
|
setLaunchDetails('Checking system info..')
|
||||||
sysAEx.send({task: 'execute', function: 'validateJava', argsArr: [ConfigManager.getLauncherDirectory(), mcVersion]})
|
sysAEx.send({task: 'execute', function: 'validateJava', argsArr: [ConfigManager.getDataDirectory(), mcVersion]})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -470,11 +474,15 @@ function dlAsync(login = true){
|
|||||||
const loggerAEx = LoggerUtil('%c[AEx]', 'color: #353232; font-weight: bold')
|
const loggerAEx = LoggerUtil('%c[AEx]', 'color: #353232; font-weight: bold')
|
||||||
const loggerLaunchSuite = LoggerUtil('%c[LaunchSuite]', 'color: #000668; font-weight: bold')
|
const loggerLaunchSuite = LoggerUtil('%c[LaunchSuite]', 'color: #000668; font-weight: bold')
|
||||||
|
|
||||||
|
const forkEnv = JSON.parse(JSON.stringify(process.env))
|
||||||
|
forkEnv.CONFIG_DIRECT_PATH = ConfigManager.getLauncherDirectory()
|
||||||
|
|
||||||
// Start AssetExec to run validations and downloads in a forked process.
|
// Start AssetExec to run validations and downloads in a forked process.
|
||||||
aEx = cp.fork(path.join(__dirname, 'assets', 'js', 'assetexec.js'), [
|
aEx = cp.fork(path.join(__dirname, 'assets', 'js', 'assetexec.js'), [
|
||||||
ConfigManager.getCommonDirectory(),
|
ConfigManager.getCommonDirectory(),
|
||||||
ConfigManager.getJavaExecutable()
|
ConfigManager.getJavaExecutable()
|
||||||
], {
|
], {
|
||||||
|
env: forkEnv,
|
||||||
stdio: 'pipe'
|
stdio: 'pipe'
|
||||||
})
|
})
|
||||||
// Stdout
|
// Stdout
|
||||||
|
@ -41,6 +41,24 @@ document.addEventListener('click', closeSettingsSelect)
|
|||||||
bindSettingsSelect()
|
bindSettingsSelect()
|
||||||
|
|
||||||
|
|
||||||
|
function bindFileSelectors(){
|
||||||
|
for(let ele of document.getElementsByClassName('settingsFileSelSel')){
|
||||||
|
if(ele.id === 'settingsJavaExecSel'){
|
||||||
|
ele.onchange = (e) => {
|
||||||
|
ele.previousElementSibling.value = ele.files[0].path
|
||||||
|
populateJavaExecDetails(ele.previousElementSibling.value)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ele.onchange = (e) => {
|
||||||
|
ele.previousElementSibling.value = ele.files[0].path
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bindFileSelectors()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* General Settings Functions
|
* General Settings Functions
|
||||||
*/
|
*/
|
||||||
@ -97,6 +115,8 @@ function initSettingsValues(){
|
|||||||
if(cVal === 'JavaExecutable'){
|
if(cVal === 'JavaExecutable'){
|
||||||
populateJavaExecDetails(v.value)
|
populateJavaExecDetails(v.value)
|
||||||
v.value = gFn()
|
v.value = gFn()
|
||||||
|
} else if (cVal === 'DataDirectory'){
|
||||||
|
v.value = gFn()
|
||||||
} else if(cVal === 'JVMOptions'){
|
} else if(cVal === 'JVMOptions'){
|
||||||
v.value = gFn().join(' ')
|
v.value = gFn().join(' ')
|
||||||
} else {
|
} else {
|
||||||
@ -905,8 +925,6 @@ const settingsMinRAMLabel = document.getElementById('settingsMinRAMLabel')
|
|||||||
const settingsMemoryTotal = document.getElementById('settingsMemoryTotal')
|
const settingsMemoryTotal = document.getElementById('settingsMemoryTotal')
|
||||||
const settingsMemoryAvail = document.getElementById('settingsMemoryAvail')
|
const settingsMemoryAvail = document.getElementById('settingsMemoryAvail')
|
||||||
const settingsJavaExecDetails = document.getElementById('settingsJavaExecDetails')
|
const settingsJavaExecDetails = document.getElementById('settingsJavaExecDetails')
|
||||||
const settingsJavaExecVal = document.getElementById('settingsJavaExecVal')
|
|
||||||
const settingsJavaExecSel = document.getElementById('settingsJavaExecSel')
|
|
||||||
|
|
||||||
// Store maximum memory values.
|
// Store maximum memory values.
|
||||||
const SETTINGS_MAX_MEMORY = ConfigManager.getAbsoluteMaxRAM()
|
const SETTINGS_MAX_MEMORY = ConfigManager.getAbsoluteMaxRAM()
|
||||||
@ -1092,12 +1110,6 @@ function populateMemoryStatus(){
|
|||||||
settingsMemoryAvail.innerHTML = Number(os.freemem()/1000000000).toFixed(1) + 'G'
|
settingsMemoryAvail.innerHTML = Number(os.freemem()/1000000000).toFixed(1) + 'G'
|
||||||
}
|
}
|
||||||
|
|
||||||
// Bind the executable file input to the display text input.
|
|
||||||
settingsJavaExecSel.onchange = (e) => {
|
|
||||||
settingsJavaExecVal.value = settingsJavaExecSel.files[0].path
|
|
||||||
populateJavaExecDetails(settingsJavaExecVal.value)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Validate the provided executable path and display the data on
|
* Validate the provided executable path and display the data on
|
||||||
* the UI.
|
* the UI.
|
||||||
|
@ -53,7 +53,6 @@
|
|||||||
<input type="number" id="settingsGameHeight" min="0" cValue="GameHeight">
|
<input type="number" id="settingsGameHeight" min="0" cValue="GameHeight">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="settingsDivider"></div>
|
|
||||||
<div class="settingsFieldContainer">
|
<div class="settingsFieldContainer">
|
||||||
<div class="settingsFieldLeft">
|
<div class="settingsFieldLeft">
|
||||||
<span class="settingsFieldTitle">Launch in fullscreen.</span>
|
<span class="settingsFieldTitle">Launch in fullscreen.</span>
|
||||||
@ -65,7 +64,6 @@
|
|||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="settingsDivider"></div>
|
|
||||||
<div class="settingsFieldContainer">
|
<div class="settingsFieldContainer">
|
||||||
<div class="settingsFieldLeft">
|
<div class="settingsFieldLeft">
|
||||||
<span class="settingsFieldTitle">Automatically connect to the server on launch.</span>
|
<span class="settingsFieldTitle">Automatically connect to the server on launch.</span>
|
||||||
@ -77,7 +75,6 @@
|
|||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="settingsDivider"></div>
|
|
||||||
<div class="settingsFieldContainer">
|
<div class="settingsFieldContainer">
|
||||||
<div class="settingsFieldLeft">
|
<div class="settingsFieldLeft">
|
||||||
<span class="settingsFieldTitle">Launch game process detached from launcher.</span>
|
<span class="settingsFieldTitle">Launch game process detached from launcher.</span>
|
||||||
@ -186,13 +183,13 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="settingsJavaExecContainer">
|
<div class="settingsFileSelContainer">
|
||||||
<div id="settingsJavaExecTitle">Java Executable</div>
|
<div class="settingsFileSelTitle">Java Executable</div>
|
||||||
<div id="settingsJavaExecContent">
|
<div class="settingsFileSelContent">
|
||||||
<div id="settingsJavaExecDetails">Selected: Java 8 Update 172 (x64)</div>
|
<div id="settingsJavaExecDetails">Selected: Java 8 Update 172 (x64)</div>
|
||||||
<div id="settingsJavaExecActions">
|
<div class="settingsFileSelActions">
|
||||||
<div class="settingsJavaIcon">
|
<div class="settingsFileSelIcon">
|
||||||
<svg class="settingsJavaIconSVG" x="0px" y="0px" viewBox="0 0 305.001 305.001">
|
<svg class="settingsFileSelSVG" x="0px" y="0px" viewBox="0 0 305.001 305.001">
|
||||||
<g>
|
<g>
|
||||||
<path d="M150.99,56.513c-14.093,9.912-30.066,21.147-38.624,39.734c-14.865,32.426,30.418,67.798,32.353,69.288c0.45,0.347,0.988,0.519,1.525,0.519c0.57,0,1.141-0.195,1.605-0.583c0.899-0.752,1.154-2.029,0.614-3.069c-0.164-0.316-16.418-31.888-15.814-54.539c0.214-7.888,11.254-16.837,22.942-26.312c10.705-8.678,22.839-18.514,29.939-30.02c15.586-25.327-1.737-50.231-1.914-50.479c-0.688-0.966-1.958-1.317-3.044-0.84c-1.085,0.478-1.686,1.652-1.438,2.811c0.035,0.164,3.404,16.633-5.97,33.6C169.301,43.634,160.816,49.603,150.99,56.513z"></path>
|
<path d="M150.99,56.513c-14.093,9.912-30.066,21.147-38.624,39.734c-14.865,32.426,30.418,67.798,32.353,69.288c0.45,0.347,0.988,0.519,1.525,0.519c0.57,0,1.141-0.195,1.605-0.583c0.899-0.752,1.154-2.029,0.614-3.069c-0.164-0.316-16.418-31.888-15.814-54.539c0.214-7.888,11.254-16.837,22.942-26.312c10.705-8.678,22.839-18.514,29.939-30.02c15.586-25.327-1.737-50.231-1.914-50.479c-0.688-0.966-1.958-1.317-3.044-0.84c-1.085,0.478-1.686,1.652-1.438,2.811c0.035,0.164,3.404,16.633-5.97,33.6C169.301,43.634,160.816,49.603,150.99,56.513z"></path>
|
||||||
<path d="M210.365,67.682c0.994-0.749,1.286-2.115,0.684-3.205c-0.602-1.09-1.913-1.571-3.077-1.129c-2.394,0.91-58.627,22.585-58.627,48.776c0,18.053,7.712,27.591,13.343,34.556c2.209,2.731,4.116,5.09,4.744,7.104c1.769,5.804-2.422,16.294-4.184,19.846c-0.508,1.022-0.259,2.259,0.605,3.005c0.467,0.403,1.05,0.607,1.634,0.607c0.497,0,0.996-0.148,1.427-0.448c0.967-0.673,23.63-16.696,19.565-36.001c-1.514-7.337-5.12-12.699-8.302-17.43c-4.929-7.329-8.489-12.624-3.088-22.403C181.419,89.556,210.076,67.899,210.365,67.682z"></path>
|
<path d="M210.365,67.682c0.994-0.749,1.286-2.115,0.684-3.205c-0.602-1.09-1.913-1.571-3.077-1.129c-2.394,0.91-58.627,22.585-58.627,48.776c0,18.053,7.712,27.591,13.343,34.556c2.209,2.731,4.116,5.09,4.744,7.104c1.769,5.804-2.422,16.294-4.184,19.846c-0.508,1.022-0.259,2.259,0.605,3.005c0.467,0.403,1.05,0.607,1.634,0.607c0.497,0,0.996-0.148,1.427-0.448c0.967-0.673,23.63-16.696,19.565-36.001c-1.514-7.337-5.12-12.699-8.302-17.43c-4.929-7.329-8.489-12.624-3.088-22.403C181.419,89.556,210.076,67.899,210.365,67.682z"></path>
|
||||||
@ -205,18 +202,18 @@
|
|||||||
</g>
|
</g>
|
||||||
</svg>
|
</svg>
|
||||||
</div>
|
</div>
|
||||||
<input id="settingsJavaExecVal" type="text" value="null" cValue="JavaExecutable" disabled>
|
<input class="settingsFileSelVal" id="settingsJavaExecVal" type="text" value="null" cValue="JavaExecutable" disabled>
|
||||||
<input id="settingsJavaExecSel" type="file" <%= process.platform === 'win32' ? 'accept=.exe' : '' %>>
|
<input class="settingsFileSelSel" id="settingsJavaExecSel" type="file" <%= process.platform === 'win32' ? 'accept=.exe' : '' %>>
|
||||||
<label id="settingsJavaExecLabel" for="settingsJavaExecSel">Choose File</label>
|
<label class="settingsFileSelLabel" for="settingsJavaExecSel">Choose File</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="settingsJavaExecDesc">The Java executable is validated before game launch. <strong>Requires Java 8 x64.</strong><br>The path should end with <strong>bin<%= process.platform === 'win32' ? '\\javaw.exe' : '/java' %></strong>.</div>
|
<div class="settingsFileSelDesc">The Java executable is validated before game launch. <strong>Requires Java 8 x64.</strong><br>The path should end with <strong>bin<%= process.platform === 'win32' ? '\\javaw.exe' : '/java' %></strong>.</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="settingsJVMOptsContainer">
|
<div id="settingsJVMOptsContainer">
|
||||||
<div id="settingsJVMOptsTitle">Additional JVM Options</div>
|
<div id="settingsJVMOptsTitle">Additional JVM Options</div>
|
||||||
<div id="settingsJVMOptsContent">
|
<div id="settingsJVMOptsContent">
|
||||||
<div class="settingsJavaIcon">
|
<div class="settingsFileSelIcon">
|
||||||
<svg class="settingsJavaIconSVG" x="0px" y="0px" viewBox="0 0 305.001 305.001">
|
<svg class="settingsFileSelSVG" x="0px" y="0px" viewBox="0 0 305.001 305.001">
|
||||||
<g>
|
<g>
|
||||||
<path d="M150.99,56.513c-14.093,9.912-30.066,21.147-38.624,39.734c-14.865,32.426,30.418,67.798,32.353,69.288c0.45,0.347,0.988,0.519,1.525,0.519c0.57,0,1.141-0.195,1.605-0.583c0.899-0.752,1.154-2.029,0.614-3.069c-0.164-0.316-16.418-31.888-15.814-54.539c0.214-7.888,11.254-16.837,22.942-26.312c10.705-8.678,22.839-18.514,29.939-30.02c15.586-25.327-1.737-50.231-1.914-50.479c-0.688-0.966-1.958-1.317-3.044-0.84c-1.085,0.478-1.686,1.652-1.438,2.811c0.035,0.164,3.404,16.633-5.97,33.6C169.301,43.634,160.816,49.603,150.99,56.513z"></path>
|
<path d="M150.99,56.513c-14.093,9.912-30.066,21.147-38.624,39.734c-14.865,32.426,30.418,67.798,32.353,69.288c0.45,0.347,0.988,0.519,1.525,0.519c0.57,0,1.141-0.195,1.605-0.583c0.899-0.752,1.154-2.029,0.614-3.069c-0.164-0.316-16.418-31.888-15.814-54.539c0.214-7.888,11.254-16.837,22.942-26.312c10.705-8.678,22.839-18.514,29.939-30.02c15.586-25.327-1.737-50.231-1.914-50.479c-0.688-0.966-1.958-1.317-3.044-0.84c-1.085,0.478-1.686,1.652-1.438,2.811c0.035,0.164,3.404,16.633-5.97,33.6C169.301,43.634,160.816,49.603,150.99,56.513z"></path>
|
||||||
<path d="M210.365,67.682c0.994-0.749,1.286-2.115,0.684-3.205c-0.602-1.09-1.913-1.571-3.077-1.129c-2.394,0.91-58.627,22.585-58.627,48.776c0,18.053,7.712,27.591,13.343,34.556c2.209,2.731,4.116,5.09,4.744,7.104c1.769,5.804-2.422,16.294-4.184,19.846c-0.508,1.022-0.259,2.259,0.605,3.005c0.467,0.403,1.05,0.607,1.634,0.607c0.497,0,0.996-0.148,1.427-0.448c0.967-0.673,23.63-16.696,19.565-36.001c-1.514-7.337-5.12-12.699-8.302-17.43c-4.929-7.329-8.489-12.624-3.088-22.403C181.419,89.556,210.076,67.899,210.365,67.682z"></path>
|
<path d="M210.365,67.682c0.994-0.749,1.286-2.115,0.684-3.205c-0.602-1.09-1.913-1.571-3.077-1.129c-2.394,0.91-58.627,22.585-58.627,48.776c0,18.053,7.712,27.591,13.343,34.556c2.209,2.731,4.116,5.09,4.744,7.104c1.769,5.804-2.422,16.294-4.184,19.846c-0.508,1.022-0.259,2.259,0.605,3.005c0.467,0.403,1.05,0.607,1.634,0.607c0.497,0,0.996-0.148,1.427-0.448c0.967-0.673,23.63-16.696,19.565-36.001c-1.514-7.337-5.12-12.699-8.302-17.43c-4.929-7.329-8.489-12.624-3.088-22.403C181.419,89.556,210.076,67.899,210.365,67.682z"></path>
|
||||||
@ -251,6 +248,26 @@
|
|||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="settingsFileSelContainer">
|
||||||
|
<div class="settingsFileSelContent">
|
||||||
|
<div class="settingsTabHeaderText" id="settingsDataDirTitle">Data Directory</div>
|
||||||
|
<div class="settingsFileSelActions">
|
||||||
|
<div class="settingsFileSelIcon">
|
||||||
|
<svg class="settingsFileSelSVG">
|
||||||
|
<g>
|
||||||
|
<path fill="gray" d="m10.044745,5c0,0.917174 -0.746246,1.667588 -1.667588,1.667588l-4.168971,0l-2.501382,0c-0.921009,0 -1.667588,0.750415 -1.667588,1.667588l0,6.670353l0,2.501382c0,0.917174 0.746604,1.667588 1.667588,1.667588l16.675882,0c0.921342,0 1.667588,-0.750415 1.667588,-1.667588l0,-2.501382l0,-8.337941c0,-0.917174 -0.746246,-1.667588 -1.667588,-1.667588l-8.337941,0z"/>
|
||||||
|
<path fill="gray" d="m1.627815,1.6c-0.921009,0 -1.667588,0.746579 -1.667588,1.667588l0,4.168971l8.337941,0l0,0.833794l11.673118,0l0,-4.168971c0,-0.921009 -0.746246,-1.667588 -1.667588,-1.667588l-8.572237,0c-0.288493,-0.497692 -0.816284,-0.833794 -1.433292,-0.833794l-6.670353,0z"/>
|
||||||
|
<path fill="lightgray" d="m10.025276,4c0,0.918984 -0.747719,1.670879 -1.670879,1.670879l-4.177198,0l-2.506319,0c-0.922827,0 -1.670879,0.751896 -1.670879,1.670879l0,6.683517l0,2.506319c0,0.918984 0.748078,1.670879 1.670879,1.670879l16.708794,0c0.923161,0 1.670879,-0.751896 1.670879,-1.670879l0,-2.506319l0,-8.354397c0,-0.918984 -0.747719,-1.670879 -1.670879,-1.670879l-8.354397,0z"/>
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
|
<input class="settingsFileSelVal" type="text" value="null" cValue="DataDirectory" disabled>
|
||||||
|
<input class="settingsFileSelSel" id="settingsDataDirSel" type="file" webkitdirectory>
|
||||||
|
<label class="settingsFileSelLabel" for="settingsDataDirSel">Choose Folder</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="settingsFileSelDesc">All game files and local Java installations will be stored in the data directory.<br>Screenshots and world saves are stored in the instance folder for the corresponding server configuration.</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="settingsTabAbout" class="settingsTab" style="display: none;">
|
<div id="settingsTabAbout" class="settingsTab" style="display: none;">
|
||||||
<div class="settingsTabHeader">
|
<div class="settingsTabHeader">
|
||||||
|
2
package-lock.json
generated
2
package-lock.json
generated
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "westeroscraftlauncher",
|
"name": "westeroscraftlauncher",
|
||||||
"version": "1.4.2",
|
"version": "1.5.0",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "westeroscraftlauncher",
|
"name": "westeroscraftlauncher",
|
||||||
"version": "1.4.2",
|
"version": "1.5.0",
|
||||||
"productName": "WesterosCraft Launcher",
|
"productName": "WesterosCraft Launcher",
|
||||||
"description": "Modded Minecraft Launcher",
|
"description": "Modded Minecraft Launcher",
|
||||||
"author": "Daniel Scalzi (https://github.com/dscalzi/)",
|
"author": "Daniel Scalzi (https://github.com/dscalzi/)",
|
||||||
@ -12,7 +12,7 @@
|
|||||||
"private": true,
|
"private": true,
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "electron index.js",
|
"start": "electron .",
|
||||||
"cilinux": "electron-builder --linux --win",
|
"cilinux": "electron-builder --linux --win",
|
||||||
"cidarwin": "electron-builder --mac",
|
"cidarwin": "electron-builder --mac",
|
||||||
"dist": "cross-env ELECTRON_BUILDER_ALLOW_UNRESOLVED_DEPENDENCIES=true electron-builder",
|
"dist": "cross-env ELECTRON_BUILDER_ALLOW_UNRESOLVED_DEPENDENCIES=true electron-builder",
|
||||||
|
Loading…
Reference in New Issue
Block a user