electron/lib/common/path-utils.ts

7 lines
226 B
TypeScript
Raw Normal View History

import * as path from 'path'
export const isParentDir = function (parent: string, dir: string) {
const relative = path.relative(parent, dir)
return !!relative && !relative.startsWith('..') && !path.isAbsolute(relative)
}