From 7f1aeca07f395971036cf4abe93cbad1268619b3 Mon Sep 17 00:00:00 2001 From: Simar Date: Fri, 7 Jul 2023 01:03:23 -0600 Subject: [PATCH] fix(windows): Use homedrive if available Signed-off-by: Simar --- pkg/scanners/cloud/aws/scanner.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pkg/scanners/cloud/aws/scanner.go b/pkg/scanners/cloud/aws/scanner.go index e64653f4d..25de2fecd 100644 --- a/pkg/scanners/cloud/aws/scanner.go +++ b/pkg/scanners/cloud/aws/scanner.go @@ -220,8 +220,11 @@ func (s *Scanner) initRegoScanner() (*rego.Scanner, error) { srcFS := s.policyFS if srcFS == nil { if runtime.GOOS == "windows" { - homeDir, _ := os.UserHomeDir() - srcFS = os.DirFS(homeDir) + homeDrive := os.Getenv("HOMEDRIVE") + if homeDrive == "" { + homeDrive = "C:" + } + srcFS = os.DirFS(homeDrive + "\\") } else { srcFS = os.DirFS("/") }