Skip to content

Commit

Permalink
fix(windows): Use homedrive if available (#1373)
Browse files Browse the repository at this point in the history
Signed-off-by: Simar <[email protected]>
  • Loading branch information
simar7 authored Jul 7, 2023
1 parent e6b020b commit 988b9e9
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pkg/scanners/cloud/aws/scanner.go
Original file line number Diff line number Diff line change
Expand Up @@ -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("/")
}
Expand Down

0 comments on commit 988b9e9

Please sign in to comment.