Skip to content

Commit 922a632

Browse files
committed
Fix an issue where hosts can not be selected when running for the first time.
1 parent 5a20740 commit 922a632

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

app/server/initWorkPath.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,25 @@
77

88
const fs = require('fs')
99
const path = require('path')
10+
const makeId = require('../libs/make-id')
1011
const version = require('../version')
1112

1213
module.exports = (work_path, sys_hosts_path) => {
13-
fs.mkdirSync(work_path)
14+
let is_dir = fs.existsSync(work_path) && fs.lstatSync(work_path).isDirectory()
15+
if (!is_dir) {
16+
fs.mkdirSync(work_path)
17+
}
1418

1519
let cnt = fs.readFileSync(sys_hosts_path, 'utf-8')
1620
let fn_data = path.join(work_path, 'data.json')
1721
let data = {
1822
list: [{
1923
title: 'My hosts',
24+
id: makeId(),
2025
content: '# My hosts'
2126
}, {
2227
title: 'backup',
28+
id: makeId(),
2329
content: cnt
2430
}],
2531
version: version

app/ui/app.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/version.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
module.exports = [3, 5, 0, 5486]
1+
module.exports = [3, 5, 0, 5487]

0 commit comments

Comments
 (0)