Skip to content

Commit 63b8ea3

Browse files
committed
Fix issue where cfg folder doesnt exist on init
1 parent d4513fe commit 63b8ea3

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "nodecg-gui",
3-
"version": "0.0.1",
3+
"version": "0.0.2",
44
"license": "MIT",
55
"scripts": {
66
"dev": "electron-webpack dev",

src/main/nodecg.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ function getNodeCGUrl(e?: Electron.IpcMainEvent) {
7070
const uri = new URI()
7171
.protocol('http')
7272
.hostname(config.host || 'localhost')
73-
.port(config.port.toString() || '9090');
73+
.port(config.port || '9090');
7474
const retVal = uri.toString();
7575
if (e !== undefined) e.returnValue = retVal;
7676
return retVal;

src/main/nodecg/config.ts

+5
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ interface ConfigData {
1313
export function readConfig(confFile: string) {
1414
let config: ConfigData = {};
1515

16+
if (!fs.existsSync(nodecgPath('cfg'))) {
17+
console.log("cfg dir does not exist, creating");
18+
fs.mkdirSync(nodecgPath('cfg'));
19+
}
20+
1621
let confPath = nodecgPath('cfg', `${confFile}.json`);
1722
try {
1823
const rawConfig = fs.readFileSync(confPath);

0 commit comments

Comments
 (0)