UNPKG

@svrooij/ftpd

Version:
15 lines (12 loc) 349 B
const pathModule = require('path'); function withCwd(cwd, path) { const firstChar = (path || '').charAt(0); cwd = cwd || pathModule.sep; path = path || ''; if (firstChar === '/' || firstChar === pathModule.sep) { cwd = pathModule.sep; } path = pathModule.join(pathModule.sep, cwd, path); return path; } module.exports = withCwd;