You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
13 lines
368 B
13 lines
368 B
'use strict'; |
|
const path = require('path'); |
|
const os = require('os'); |
|
|
|
const homeDirectory = os.homedir(); |
|
|
|
module.exports = absolutePath => { |
|
const normalizedPath = path.normalize(absolutePath) + path.sep; |
|
|
|
return (normalizedPath.indexOf(homeDirectory) === 0 ? |
|
normalizedPath.replace(homeDirectory + path.sep, `~${path.sep}`) : |
|
normalizedPath).slice(0, -1); |
|
};
|
|
|