diff --git a/internal/bundled/noembed.go b/internal/bundled/noembed.go index 8a3e29235d..5ca2a9676b 100644 --- a/internal/bundled/noembed.go +++ b/internal/bundled/noembed.go @@ -5,12 +5,12 @@ package bundled import ( "fmt" "os" - "path/filepath" "sync" "testing" "github.com/microsoft/typescript-go/internal/tspath" "github.com/microsoft/typescript-go/internal/vfs" + "github.com/microsoft/typescript-go/internal/vfs/osvfs" ) const embedded = false @@ -24,11 +24,9 @@ var executableDir = sync.OnceValue(func() string { if err != nil { panic(fmt.Sprintf("bundled: failed to get executable path: %v", err)) } - exe, err = filepath.EvalSymlinks(exe) - if err != nil { - panic(fmt.Sprintf("bundled: failed to evaluate symlinks: %v", err)) - } - return filepath.Dir(exe) + exe = tspath.NormalizeSlashes(exe) + exe = osvfs.FS().Realpath(exe) + return tspath.GetDirectoryPath(exe) }) var libPath = sync.OnceValue(func() string { @@ -37,10 +35,10 @@ var libPath = sync.OnceValue(func() string { } dir := executableDir() - libdts := filepath.Join(dir, "lib.d.ts") - if _, err := os.Stat(libdts); err != nil { + libdts := tspath.CombinePaths(dir, "lib.d.ts") + if info := osvfs.FS().Stat(libdts); info == nil { panic(fmt.Sprintf("bundled: %v does not exist; this executable may be misplaced", libdts)) } - return tspath.NormalizeSlashes(dir) + return dir })