forked from noxious/server
Renamed utilities to files, added datetimeManager, npm update
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
import config from './config'
|
||||
import path from 'path'
|
||||
import fs from 'fs'
|
||||
|
||||
export function getRootPath(folder: string, ...additionalSegments: string[]) {
|
||||
return path.join(process.cwd(), folder, ...additionalSegments)
|
||||
@ -13,3 +14,20 @@ export function getAppPath(folder: string, ...additionalSegments: string[]) {
|
||||
export function getPublicPath(folder: string, ...additionalSegments: string[]) {
|
||||
return path.join(process.cwd(), 'public', folder, ...additionalSegments)
|
||||
}
|
||||
|
||||
export function doesPathExist(path: string) {
|
||||
try {
|
||||
fs.accessSync(path, fs.constants.F_OK);
|
||||
return true;
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
export function createDir(path: string) {
|
||||
try {
|
||||
fs.mkdirSync(path, { recursive: true });
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
}
|
@ -12,7 +12,7 @@ import fs from 'fs'
|
||||
import zoneRepository from '../repositories/zoneRepository'
|
||||
import zoneManager from '../managers/zoneManager'
|
||||
import { httpLogger } from './logger'
|
||||
import { getPublicPath } from './utilities'
|
||||
import { getPublicPath } from './files'
|
||||
|
||||
async function addHttpRoutes(app: Application) {
|
||||
/**
|
||||
|
@ -1,6 +1,6 @@
|
||||
import pino from 'pino'
|
||||
import fs from 'fs'
|
||||
import { getRootPath } from './utilities'
|
||||
import { getRootPath } from './files'
|
||||
|
||||
// Array of log types
|
||||
const LOG_TYPES = ['http', 'game', 'gameMaster', 'app', 'queue', 'command'] as const
|
||||
|
Reference in New Issue
Block a user