diff options
Diffstat (limited to 'src/internal-server/start.ts')
-rw-r--r-- | src/internal-server/start.ts | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/internal-server/start.ts b/src/internal-server/start.ts index 392f7cf41..62311b21e 100644 --- a/src/internal-server/start.ts +++ b/src/internal-server/start.ts | |||
@@ -17,27 +17,27 @@ | |||
17 | 17 | ||
18 | import fold from '@adonisjs/fold'; | 18 | import fold from '@adonisjs/fold'; |
19 | import { Ignitor } from '@adonisjs/ignitor'; | 19 | import { Ignitor } from '@adonisjs/ignitor'; |
20 | import fs from 'fs-extra'; | 20 | import { existsSync, readFile, statSync, chmodSync, writeFile } from 'fs-extra'; |
21 | import path from 'path'; | 21 | import { join } from 'path'; |
22 | import { LOCAL_HOSTNAME } from '../config'; | 22 | import { LOCAL_HOSTNAME } from '../config'; |
23 | import { isWindows } from '../environment'; | 23 | import { isWindows } from '../environment'; |
24 | 24 | ||
25 | process.env.ENV_PATH = path.join(__dirname, 'env.ini'); | 25 | process.env.ENV_PATH = join(__dirname, 'env.ini'); |
26 | 26 | ||
27 | export const server = async (userPath: string, port: number) => { | 27 | export const server = async (userPath: string, port: number) => { |
28 | const dbPath = path.join(userPath, 'server.sqlite'); | 28 | const dbPath = join(userPath, 'server.sqlite'); |
29 | const dbTemplatePath = path.join(__dirname, 'database', 'template.sqlite'); | 29 | const dbTemplatePath = join(__dirname, 'database', 'template.sqlite'); |
30 | 30 | ||
31 | if (!fs.existsSync(dbPath)) { | 31 | if (!existsSync(dbPath)) { |
32 | // Manually copy file | 32 | // Manually copy file |
33 | // We can't use copyFile here as it will cause the file to be readonly on Windows | 33 | // We can't use copyFile here as it will cause the file to be readonly on Windows |
34 | const dbTemplate = await fs.readFile(dbTemplatePath); | 34 | const dbTemplate = await readFile(dbTemplatePath); |
35 | await fs.writeFile(dbPath, dbTemplate); | 35 | await writeFile(dbPath, dbTemplate); |
36 | 36 | ||
37 | // Change permissions to ensure to file is not read-only | 37 | // Change permissions to ensure to file is not read-only |
38 | if (isWindows) { | 38 | if (isWindows) { |
39 | // eslint-disable-next-line no-bitwise | 39 | // eslint-disable-next-line no-bitwise |
40 | fs.chmodSync(dbPath, fs.statSync(dbPath).mode | 146); | 40 | chmodSync(dbPath, statSync(dbPath).mode | 146); |
41 | } | 41 | } |
42 | } | 42 | } |
43 | 43 | ||