// NewPathSpecWithBaseBaseFsProvided creats a new PathSpec from the given filesystems and language.
// If an existing BaseFs is provided, parts of that is reused.
979562
func NewPathSpecWithBaseBaseFsProvided(fs *hugofs.Fs, cfg config.Provider, baseBaseFs *filesystems.BaseFs) (*PathSpec, error) {

	p, err := paths.New(fs, cfg)
	if err != nil {
		return nil, err
	}

	var options []func(*filesystems.BaseFs) error
	if baseBaseFs != nil {
		options = []func(*filesystems.BaseFs) error{
			filesystems.WithBaseFs(baseBaseFs),
		}
	}
	bfs, err := filesystems.NewBase(p, options...)
	if err != nil {
		return nil, err
	}

	ps := &PathSpec{
		Paths:           p,
		BaseFs:          bfs,
		Fs:              fs,
		Cfg:             cfg,
		ProcessingStats: NewProcessingStats(p.Lang()),
	}

	basePath := ps.BaseURL.Path()
	if basePath != "" && basePath != "/" {
		ps.BasePath = basePath
	}

	return ps, nil
}
61121
func (o *GetHealthzURL) WithBasePath(bp string) *GetHealthzURL {
	o.SetBasePath(bp)
	return o
}
292730
func (o *AddOneURL) WithBasePath(bp string) *AddOneURL {
	o.SetBasePath(bp)
	return o
}
336907
func (o *CreateUsersWithArrayInputURL) WithBasePath(bp string) *CreateUsersWithArrayInputURL {
	o.SetBasePath(bp)
	return o
}
25910
func (o *FindPetsByTagsURL) WithBasePath(bp string) *FindPetsByTagsURL {
	o.SetBasePath(bp)
	return o
}
972779
func (o *GetLoginURL) WithBasePath(bp string) *GetLoginURL {
	o.SetBasePath(bp)
	return o
}
388895
func (o *PatchEndpointIDConfigURL) WithBasePath(bp string) *PatchEndpointIDConfigURL {
	o.SetBasePath(bp)
	return o
}
921065
func (o *GetFqdnCacheURL) WithBasePath(bp string) *GetFqdnCacheURL {
	o.SetBasePath(bp)
	return o
}
689242
func (o *GetOrderByIDURL) WithBasePath(bp string) *GetOrderByIDURL {
	o.SetBasePath(bp)
	return o
}
591541
func PathWithinBase(fullPath, basePath string) bool {
	rel, err := filepath.Rel(basePath, fullPath)
	if err != nil {
		return false
	}
	if StartsWithBackstep(rel) {
		// Needed to escape the base path
		return false
	}
	return true
}
1096932
func (o *GetEndpointIDHealthzURL) WithBasePath(bp string) *GetEndpointIDHealthzURL {
	o.SetBasePath(bp)
	return o
}
711392
func (p *PathSpec) PrependBasePath(rel string, isAbs bool) string {
	basePath := p.GetBasePath(!isAbs)
	if basePath != "" {
		rel = filepath.ToSlash(rel)
		// Need to prepend any path from the baseURL
		hadSlash := strings.HasSuffix(rel, "/")
		rel = path.Join(basePath, rel)
		if hadSlash {
			rel += "/"
		}
	}
	return rel
}
1100872
func (o *GetMapNameURL) WithBasePath(bp string) *GetMapNameURL {
	o.SetBasePath(bp)
	return o
}
500086
func WithSpecFromFile(filename string) SpecOpts {
	return func(ctx context.Context, c Client, container *containers.Container, s *Spec) error {
		p, err := ioutil.ReadFile(filename)
		if err != nil {
			return errors.Wrap(err, "cannot load spec config file")
		}
		return WithSpecFromBytes(p)(ctx, c, container, s)
	}
}
876800
func (o *GetTaskDetailsURL) WithBasePath(bp string) *GetTaskDetailsURL {
	o.SetBasePath(bp)
	return o
}
401099
func AppCreatedPathFromStage1Rootfs(rootfs, appName string) string {
	return filepath.Join(AppsStatusesPathFromStage1Rootfs(rootfs), fmt.Sprintf("%s-created", appName))
}
996969
func (o *GetEndpointURL) WithBasePath(bp string) *GetEndpointURL {
	o.SetBasePath(bp)
	return o
}