new path homedir() method

This commit is contained in:
metacryst
2024-01-12 07:38:36 -06:00
parent a5bff92220
commit 110ec82b8e

View File

@@ -136,6 +136,12 @@ export default class Path {
static join(...segments) {
return new PathProcessor(null).join(...segments);
}
static homedir() {
if(typeof module === 'undefined' || !module.exports) return;
const os = require('os')
return os.homedir().replace(/\\/g, '/').replace(/^[a-zA-Z]:/, '');
}
}
window.Path = Path;