mirror of
https://github.com/AgentSeal/codeburn.git
synced 2026-08-21 14:34:32 +00:00
8 lines
330 B
JavaScript
8 lines
330 B
JavaScript
import { posix, win32 } from 'node:path'
|
|
import { fileURLToPath } from 'node:url'
|
|
|
|
export function rootFromModuleUrl(moduleUrl, windows = process.platform === 'win32') {
|
|
const path = windows ? win32 : posix
|
|
const scriptPath = fileURLToPath(moduleUrl, { windows })
|
|
return path.resolve(path.dirname(scriptPath), '..', '..')
|
|
}
|