Răsfoiți Sursa

refactor(home-paths): simplify cache path dispatch

turtle1999 1 săptămână în urmă
părinte
comite
d76704170b
1 a modificat fișierele cu 2 adăugiri și 3 ștergeri
  1. 2 3
      packages/util/home-paths/src/index.ts

+ 2 - 3
packages/util/home-paths/src/index.ts

@@ -106,9 +106,8 @@ export function dshHomePath(...segments: string[]): string {
  * @returns the normalized absolute cache path.
  * @returns the normalized absolute cache path.
  */
  */
 export function dshCachePath(optionsOrSegment: { dshHome?: string } | string = {}, ...segments: string[]): string {
 export function dshCachePath(optionsOrSegment: { dshHome?: string } | string = {}, ...segments: string[]): string {
-  const configured = typeof optionsOrSegment === 'string' ? undefined : optionsOrSegment.dshHome
-  const children = typeof optionsOrSegment === 'string' ? [optionsOrSegment, ...segments] : segments
-  return join(resolveDshHome(configured), 'cache', ...children)
+  if (typeof optionsOrSegment === 'string') return dshHomePath('cache', optionsOrSegment, ...segments)
+  return join(resolveDshHome(optionsOrSegment.dshHome), 'cache', ...segments)
 }
 }
 
 
 /**
 /**