Enable SA data to be stored in user documents folder
This commit is contained in:
1 parent
6680d4495c
commit
7d7be12a48
3 files changed
+9
-12
No files matched your search
+4
-4
@@ -28,10 +28,10 @@ exports.newEnvironment = function () {
|
||||
PATH_TO_FONTS: path.join(basePath, './Platform/WebServer/Fonts')
|
||||
}
|
||||
|
||||
if (process.env.PORTABLE_EXECUTABLE_DIR) {
|
||||
thisObject.PATH_TO_DATA_STORAGE = path.join(process.env.PORTABLE_USER_DOCUMENTS, '/Superalgos/Platform/My-Data-Storage')
|
||||
thisObject.PATH_TO_LOG_FILES = path.join(process.env.PORTABLE_USER_DOCUMENTS, '/Superalgos/Platform/My-Log-Files')
|
||||
thisObject.PATH_TO_MY_WORKSPACES = path.join(process.env.PORTABLE_USER_DOCUMENTS, '/Superalgos/Platform/My-Workspaces')
|
||||
if (process.env.DATA_PATH) {
|
||||
thisObject.PATH_TO_DATA_STORAGE = path.join(process.env.DATA_PATH, '/Superalgos_Data/My-Data-Storage')
|
||||
thisObject.PATH_TO_LOG_FILES = path.join(process.env.DATA_PATH, '/Superalgos_Data/My-Log-Files')
|
||||
thisObject.PATH_TO_MY_WORKSPACES = path.join(process.env.DATA_PATH, '/Superalgos_Data/My-Workspaces')
|
||||
}
|
||||
|
||||
return thisObject
|
||||
|
||||
@@ -598,7 +598,7 @@ exports.newHttpInterface = function newHttpInterface() {
|
||||
|
||||
function createNewDir(path) {
|
||||
try {
|
||||
fs.mkdirSync(path)
|
||||
fs.mkdirSync(path, {recursive: true})
|
||||
} catch (err) {
|
||||
if (err.message.indexOf('file already exists') < 0) {
|
||||
throw (err)
|
||||
@@ -1805,7 +1805,7 @@ exports.newHttpInterface = function newHttpInterface() {
|
||||
|
||||
/* Create Dir if it does not exist */
|
||||
if (!fs.existsSync(dir)) {
|
||||
fs.mkdirSync(dir);
|
||||
fs.mkdirSync(dir, {recursive: true});
|
||||
}
|
||||
|
||||
fs.writeFile(filePath, fileContent, onFileWritten)
|
||||
|
||||
+3
-6
@@ -8,6 +8,7 @@ const {autoUpdater} = require("electron-updater")
|
||||
// Enable non contribution mode (test)
|
||||
process.env.SA_MODE = 'gitDisable'
|
||||
process.env.PACKAGED_PATH = app.getAppPath()
|
||||
process.env.DATA_PATH = app.getPath('documents')
|
||||
|
||||
const WINDOW_WIDTH = null
|
||||
const WINDOW_HEIGHT = null
|
||||
@@ -22,12 +23,8 @@ const port = 34248 // Default HTTP port
|
||||
run()
|
||||
|
||||
function run() {
|
||||
if (process.env.PORTABLE_EXECUTABLE_DIR) {
|
||||
process.env.PORTABLE_USER_DOCUMENTS = app.getPath("userData")
|
||||
}
|
||||
|
||||
const { fork } = require('child_process')
|
||||
const platform = fork(path.join(__dirname, '/PlatformRoot.js'), ["noBrowser"], {stdio: ['pipe', 'pipe', 'pipe', 'ipc']})
|
||||
const platform = fork(path.join(__dirname, '/PlatformRoot.js'), ["noBrowser"], {stdio: ['pipe', 'pipe', 'pipe', 'ipc'], env: process.env})
|
||||
platform.on('message', message => {
|
||||
if(message == "Running") {
|
||||
open()
|
||||
@@ -38,7 +35,7 @@ function run() {
|
||||
function open () {
|
||||
let bw_options = {
|
||||
width: WINDOW_WIDTH ? WINDOW_WIDTH : 1280,
|
||||
height: WINDOW_HEIGHT ? WINDOW_HEIGHT : 720,
|
||||
height: WINDOW_HEIGHT ? WINDOW_HEIGHT : 768,
|
||||
resizable: true
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user