File tree Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -59,6 +59,7 @@ export default class Executables {
5959 * Only returns direct children, or the path itself if it's an executable.
6060 */
6161function findExecutablesInPath ( path : string ) : Promise < string [ ] > {
62+ path = FsUtil . untildify ( path )
6263 return new Promise ( ( resolve , _ ) => {
6364 Fs . lstat ( path , ( err , stat ) => {
6465 if ( err ) {
Original file line number Diff line number Diff line change 11import * as Fs from 'fs'
2+ import * as Os from 'os'
23
34export function getStats ( path : string ) : Promise < Fs . Stats > {
45 return new Promise ( ( resolve , reject ) => {
@@ -11,3 +12,11 @@ export function getStats(path: string): Promise<Fs.Stats> {
1112 } )
1213 } )
1314}
15+
16+ // from https://github.com/sindresorhus/untildify/blob/master/index.js#L11
17+ export function untildify ( pathWithTilde : string ) : string {
18+ const homeDirectory = Os . homedir ( )
19+ return homeDirectory
20+ ? pathWithTilde . replace ( / ^ ~ (? = $ | \/ | \\ ) / , homeDirectory )
21+ : pathWithTilde
22+ }
You can’t perform that action at this time.
0 commit comments