mirror of
https://gitlab.com/MrFry/mrfrys-node-server
synced 2025-04-01 20:24:18 +02:00
write file fix
This commit is contained in:
@@ -48,6 +48,7 @@ import logger from '../utils/logger'
|
|||||||
|
|
||||||
import { paths } from './files'
|
import { paths } from './files'
|
||||||
import { Request } from '../types/basicTypes'
|
import { Request } from '../types/basicTypes'
|
||||||
|
import path from 'node:path'
|
||||||
|
|
||||||
interface URLFormatOptions {
|
interface URLFormatOptions {
|
||||||
pathname?: string
|
pathname?: string
|
||||||
@@ -151,12 +152,8 @@ function WatchFile(file: string, callback: Function): void {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function createDirsForFile(path: string): void {
|
function createDirsForFile(dir: string): void {
|
||||||
let pathPart = path
|
const pathPart = path.dirname(dir)
|
||||||
if (pathPart.endsWith('/')) {
|
|
||||||
pathPart = pathPart.slice(0, -1)
|
|
||||||
}
|
|
||||||
pathPart = path.split('/').slice(0, -1).join('/')
|
|
||||||
CreatePath(pathPart)
|
CreatePath(pathPart)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user