@@ -38,7 +38,8 @@ import { getNodePath } from '../node/path'
3838 */
3939export function getOsHomeDir ( ) : string {
4040 // Always check for overrides - don't cache when using rewire
41- return getPathValue ( 'homedir' , ( ) => getNodeOs ( ) . homedir ( ) )
41+ const os = getNodeOs ( )
42+ return getPathValue ( 'homedir' , ( ) => os . homedir ( ) )
4243}
4344/**
4445 * Get the OS temporary directory. Can be overridden in tests using
@@ -51,7 +52,8 @@ export function getOsHomeDir(): string {
5152 */
5253export function getOsTmpDir ( ) : string {
5354 // Always check for overrides - don't cache when using rewire
54- return getPathValue ( 'tmpdir' , ( ) => getNodeOs ( ) . tmpdir ( ) )
55+ const os = getNodeOs ( )
56+ return getPathValue ( 'tmpdir' , ( ) => os . tmpdir ( ) )
5557}
5658/**
5759 * Get a Socket app cache directory (~/.socket/_<appName>/cache).
@@ -61,7 +63,8 @@ export function getOsTmpDir(): string {
6163 * Get a Socket app cache directory (~/.socket/_<appName>/cache).
6264 */
6365export function getSocketAppCacheDir ( appName : string ) : string {
64- return normalizePath ( getNodePath ( ) . join ( getSocketAppDir ( appName ) , CACHE_DIR ) )
66+ const path = getNodePath ( )
67+ return normalizePath ( path . join ( getSocketAppDir ( appName ) , CACHE_DIR ) )
6568}
6669/**
6770 * Get a Socket app TTL cache directory (~/.socket/_<appName>/cache/ttl).
@@ -71,9 +74,8 @@ export function getSocketAppCacheDir(appName: string): string {
7174 * Get a Socket app TTL cache directory (~/.socket/_<appName>/cache/ttl).
7275 */
7376export function getSocketAppCacheTtlDir ( appName : string ) : string {
74- return normalizePath (
75- getNodePath ( ) . join ( getSocketAppCacheDir ( appName ) , CACHE_TTL_DIR ) ,
76- )
77+ const path = getNodePath ( )
78+ return normalizePath ( path . join ( getSocketAppCacheDir ( appName ) , CACHE_TTL_DIR ) )
7779}
7880/**
7981 * Get a Socket app directory (~/.socket/_<appName>).
@@ -83,8 +85,9 @@ export function getSocketAppCacheTtlDir(appName: string): string {
8385 * Get a Socket app directory (~/.socket/_<appName>).
8486 */
8587export function getSocketAppDir ( appName : string ) : string {
88+ const path = getNodePath ( )
8689 return normalizePath (
87- getNodePath ( ) . join ( getSocketUserDir ( ) , `${ SOCKET_APP_PREFIX } ${ appName } ` ) ,
90+ path . join ( getSocketUserDir ( ) , `${ SOCKET_APP_PREFIX } ${ appName } ` ) ,
8891 )
8992}
9093/**
@@ -115,8 +118,9 @@ export function getSocketCacacheDir(): string {
115118 if ( getSocketCacacheDirEnv ( ) ) {
116119 return normalizePath ( getSocketCacacheDirEnv ( ) as string )
117120 }
121+ const path = getNodePath ( )
118122 return normalizePath (
119- getNodePath ( ) . join ( getSocketUserDir ( ) , `${ SOCKET_APP_PREFIX } cacache` ) ,
123+ path . join ( getSocketUserDir ( ) , `${ SOCKET_APP_PREFIX } cacache` ) ,
120124 )
121125 } )
122126}
@@ -162,8 +166,9 @@ export function getSocketDlxDir(): string {
162166 if ( getSocketDlxDirEnv ( ) ) {
163167 return normalizePath ( getSocketDlxDirEnv ( ) as string )
164168 }
169+ const path = getNodePath ( )
165170 return normalizePath (
166- getNodePath ( ) . join (
171+ path . join (
167172 getSocketUserDir ( ) ,
168173 `${ SOCKET_APP_PREFIX } ${ SOCKET_DLX_APP_NAME } ` ,
169174 ) ,
@@ -202,8 +207,9 @@ export function getSocketRegistryDir(): string {
202207 * (~/.socket/_registry/cache/ttl/github).
203208 */
204209export function getSocketRegistryGithubCacheDir ( ) : string {
210+ const path = getNodePath ( )
205211 return normalizePath (
206- getNodePath ( ) . join (
212+ path . join (
207213 getSocketAppCacheTtlDir ( SOCKET_REGISTRY_APP_NAME ) ,
208214 CACHE_GITHUB_DIR ,
209215 ) ,
@@ -243,7 +249,8 @@ export function getSocketUserDir(): string {
243249 if ( socketHome ) {
244250 return normalizePath ( socketHome )
245251 }
246- return normalizePath ( getNodePath ( ) . join ( getUserHomeDir ( ) , DOT_SOCKET_DIR ) )
252+ const path = getNodePath ( )
253+ return normalizePath ( path . join ( getUserHomeDir ( ) , DOT_SOCKET_DIR ) )
247254 } )
248255}
249256/**
@@ -272,8 +279,9 @@ export function getSocketUserDir(): string {
272279 */
273280export function getSocketWheelhouseDir ( ) : string {
274281 return getPathValue ( 'socket-wheelhouse-dir' , ( ) => {
282+ const path = getNodePath ( )
275283 return normalizePath (
276- getNodePath ( ) . join (
284+ path . join (
277285 getSocketUserDir ( ) ,
278286 `${ SOCKET_APP_PREFIX } ${ SOCKET_WHEELHOUSE_APP_NAME } ` ,
279287 ) ,
0 commit comments