From 9c92c3e08a665e7e43322902c4876a9c84277d7d Mon Sep 17 00:00:00 2001 From: Selena Goods Date: Tue, 22 Oct 2024 16:49:55 -0400 Subject: [PATCH] Use `filepath.Join` instead of `website/docs` for windows compatability. --- internal/provider/migrate.go | 4 ++-- internal/provider/validate.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/provider/migrate.go b/internal/provider/migrate.go index babe2127..3ae1af11 100644 --- a/internal/provider/migrate.go +++ b/internal/provider/migrate.go @@ -381,7 +381,7 @@ func (m *migrator) ProviderExamplesDir() string { func determineWebsiteDir(providerDir string) (string, error) { // Check for legacy website directory - providerWebsiteDirFileInfo, err := os.Stat(filepath.Join(providerDir, "website/docs")) + providerWebsiteDirFileInfo, err := os.Stat(filepath.Join(providerDir, "website", "docs")) if err != nil { if os.IsNotExist(err) { @@ -390,7 +390,7 @@ func determineWebsiteDir(providerDir string) (string, error) { return "", fmt.Errorf("error getting information for provider website directory %q: %w", providerDir, err) } } else if providerWebsiteDirFileInfo.IsDir() { - return "website/docs", nil + return filepath.Join("website", "docs"), nil } // Check for docs directory diff --git a/internal/provider/validate.go b/internal/provider/validate.go index 9500354f..9448d53b 100644 --- a/internal/provider/validate.go +++ b/internal/provider/validate.go @@ -172,7 +172,7 @@ func (v *validator) validate(ctx context.Context) error { result = errors.Join(result, err) } - if dirExists(v.providerFS, "website/docs") { + if dirExists(v.providerFS, filepath.Join("website", "docs")) { v.logger.infof("detected legacy website directory, running checks") err = v.validateLegacyWebsite() result = errors.Join(result, err) @@ -263,7 +263,7 @@ func (v *validator) validateStaticDocs() error { } func (v *validator) validateLegacyWebsite() error { - dir := "website/docs" + dir := filepath.Join("website", "docs") var result error options := &check.ProviderFileOptions{