write file fix

This commit is contained in:
mrfry 2023-05-02 08:09:42 +02:00
parent 9665db7bbe
commit 0fea32c204

View file

@ -48,6 +48,7 @@ import logger from '../utils/logger'
import { paths } from './files'
import { Request } from '../types/basicTypes'
import path from 'node:path'
interface URLFormatOptions {
pathname?: string
@ -151,12 +152,8 @@ function WatchFile(file: string, callback: Function): void {
}
}
function createDirsForFile(path: string): void {
let pathPart = path
if (pathPart.endsWith('/')) {
pathPart = pathPart.slice(0, -1)
}
pathPart = path.split('/').slice(0, -1).join('/')
function createDirsForFile(dir: string): void {
const pathPart = path.dirname(dir)
CreatePath(pathPart)
}