import { resolve } from "path" ; export function canonical_paths ( paths ) { const v = [ ] ; const { HOME } = process . env ; if ( HOME == null ) { throw Error ( "HOME environment variable must be defined" ) ; } for ( let path of paths ) { path = resolve ( path ) ; if ( path . startsWith ( HOME ) ) { v . push ( path . slice ( HOME . length + 1 ) ) ; } else { v . push ( HOME + "/.smc/root" + path ) ; } } return v ; }