42 lines
1.0 KiB
Go
42 lines
1.0 KiB
Go
package tsoptionstest
|
|
|
|
import (
|
|
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/tsoptions"
|
|
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/tspath"
|
|
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/vfs"
|
|
"efprojects.com/kitten-ipc/kitcom/internal/tsgo/vfs/vfstest"
|
|
)
|
|
|
|
func fixRoot(path string) string {
|
|
rootLength := tspath.GetRootLength(path)
|
|
if rootLength == 0 {
|
|
return path
|
|
}
|
|
if len(path) == rootLength {
|
|
return "."
|
|
}
|
|
return path[rootLength:]
|
|
}
|
|
|
|
type VfsParseConfigHost struct {
|
|
Vfs vfs.FS
|
|
CurrentDirectory string
|
|
}
|
|
|
|
var _ tsoptions.ParseConfigHost = (*VfsParseConfigHost)(nil)
|
|
|
|
func (h *VfsParseConfigHost) FS() vfs.FS {
|
|
return h.Vfs
|
|
}
|
|
|
|
func (h *VfsParseConfigHost) GetCurrentDirectory() string {
|
|
return h.CurrentDirectory
|
|
}
|
|
|
|
func NewVFSParseConfigHost(files map[string]string, currentDirectory string, useCaseSensitiveFileNames bool) *VfsParseConfigHost {
|
|
return &VfsParseConfigHost{
|
|
Vfs: vfstest.FromMap(files, useCaseSensitiveFileNames),
|
|
CurrentDirectory: currentDirectory,
|
|
}
|
|
}
|