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:
@@ -41,6 +41,24 @@ document.addEventListener('click', closeSettingsSelect)
|
||||
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
|
||||
*/
|
||||
@@ -97,6 +115,8 @@ function initSettingsValues(){
|
||||
if(cVal === 'JavaExecutable'){
|
||||
populateJavaExecDetails(v.value)
|
||||
v.value = gFn()
|
||||
} else if (cVal === 'DataDirectory'){
|
||||
v.value = gFn()
|
||||
} else if(cVal === 'JVMOptions'){
|
||||
v.value = gFn().join(' ')
|
||||
} else {
|
||||
@@ -905,8 +925,6 @@ const settingsMinRAMLabel = document.getElementById('settingsMinRAMLabel')
|
||||
const settingsMemoryTotal = document.getElementById('settingsMemoryTotal')
|
||||
const settingsMemoryAvail = document.getElementById('settingsMemoryAvail')
|
||||
const settingsJavaExecDetails = document.getElementById('settingsJavaExecDetails')
|
||||
const settingsJavaExecVal = document.getElementById('settingsJavaExecVal')
|
||||
const settingsJavaExecSel = document.getElementById('settingsJavaExecSel')
|
||||
|
||||
// Store maximum memory values.
|
||||
const SETTINGS_MAX_MEMORY = ConfigManager.getAbsoluteMaxRAM()
|
||||
@@ -1092,12 +1110,6 @@ function populateMemoryStatus(){
|
||||
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
|
||||
* the UI.
|
||||
|
||||
Reference in New Issue
Block a user