Skip to content

Commit

Permalink
Make config relative to installation (portable)
Browse files Browse the repository at this point in the history
  • Loading branch information
giflw committed Nov 14, 2022
1 parent 5c4dfa7 commit 319217c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
4 changes: 2 additions & 2 deletions applications/electron/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "Eclipse Theia blueprint product",
"productName": "Theia Blueprint",
"version": "1.31.1",
"main": "scripts/theia-electron-main.js",
"main": "scripts/eos-thesis-electron-main.js",
"license": "EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0",
"author": "Eclipse Theia <[email protected]>",
"homepage": "https://github.com/giflw/eos-thesis-ide#readme",
Expand Down Expand Up @@ -120,7 +120,7 @@
"build": "theia rebuild:electron && yarn bundle",
"bundle": "theia build",
"watch": "concurrently -n compile,bundle \"theiaext watch --preserveWatchOutput\" \"theia build --watch --mode development\"",
"start": "electron scripts/theia-electron-main.js",
"start": "electron scripts/eos-thesis-electron-main.js",
"start:debug": "yarn start --log-level=debug",
"package": "yarn clean:dist && electron-builder -c.mac.identity=null --publish never",
"deploy": "yarn clean:dist && electron-builder -c.mac.identity=null --publish always",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
const path = require('path')
const os = require('os')
const fs = require('fs')
const { app } = require('electron');

const userDataPath = path.resolve(app.getAppPath(), '../../', 'data/frontend');
const pluginsPath = path.resolve(app.getAppPath(), '../../', 'data/plugins');

[userDataPath, pluginsPath].forEach(p => fs.existsSync(p) ? fs.mkdirSync(p, {recursive : true}) : null)

app.setPath('userData', userDataPath);


// Update to override the supported VS Code API version.
// process.env.VSCODE_API_VERSION = '1.50.0'
Expand All @@ -9,7 +18,7 @@ process.env.THEIA_DEFAULT_PLUGINS = `local-dir:${path.resolve(__dirname, '..', '

// Lookup inside the user's home folder for more plugins, and accept user-defined paths.
process.env.THEIA_PLUGINS = [
process.env.THEIA_PLUGINS, `local-dir:${path.resolve(os.homedir(), '.theia', 'plugins')}`,
process.env.THEIA_PLUGINS, `local-dir:${pluginsPath}`,
].filter(Boolean).join(',')

// Handover to the auto-generated electron application handler.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
********************************************************************************/

import * as os from 'os';
//import * as os from 'os';
import * as path from 'path';
import { injectable } from '@theia/core/shared/inversify';
import { FileUri } from '@theia/core/lib/node/file-uri';
Expand All @@ -23,7 +23,9 @@ import { EnvVariablesServerImpl } from '@theia/core/lib/node/env-variables';
@injectable()
export class EosThesisEnvVariableServer extends EnvVariablesServerImpl {

protected readonly _configDirUri: string = FileUri.create(path.join(os.homedir(), '.eos-thesis')).toString(true);
//protected readonly _configDirUri: string = FileUri.create(path.join(os.homedir(), '.eos-thesis')).toString(true);
protected readonly _configDirUri: string = FileUri.create(path.resolve(process.execPath, '../data/backend')).toString(true);


async getConfigDirUri(): Promise<string> {
return this._configDirUri;
Expand Down

0 comments on commit 319217c

Please sign in to comment.