@@ -74,16 +74,25 @@ func Initialize(flags *pflag.FlagSet, projectPaths []string) error {
74
74
reportFilePathString , _ := flags .GetString ("report-file" )
75
75
reportFilePath = paths .New (reportFilePathString )
76
76
77
- for _ , projectPath := range projectPaths {
78
- targetPath := paths . New ( projectPath )
79
- targetPathExists , err := targetPath . ExistCheck ()
77
+ if len ( projectPaths ) == 0 {
78
+ // Default to using current working directory.
79
+ workingDirectoryPath , err := os . Getwd ()
80
80
if err != nil {
81
- return fmt .Errorf ("Problem processing PROJECT_PATH argument value %v : %v" , targetPath , err )
81
+ return fmt .Errorf ("Error when setting default PROJECT_PATH argument : %s" , err )
82
82
}
83
- if ! targetPathExists {
84
- return fmt .Errorf ("PROJECT_PATH argument %v does not exist" , targetPath )
83
+ targetPaths .Add (paths .New (workingDirectoryPath ))
84
+ } else {
85
+ for _ , projectPath := range projectPaths {
86
+ targetPath := paths .New (projectPath )
87
+ targetPathExists , err := targetPath .ExistCheck ()
88
+ if err != nil {
89
+ return fmt .Errorf ("Problem processing PROJECT_PATH argument value %v: %v" , targetPath , err )
90
+ }
91
+ if ! targetPathExists {
92
+ return fmt .Errorf ("PROJECT_PATH argument %v does not exist" , targetPath )
93
+ }
94
+ targetPaths .AddIfMissing (targetPath )
85
95
}
86
- targetPaths .AddIfMissing (targetPath )
87
96
}
88
97
89
98
if officialModeString , ok := os .LookupEnv ("ARDUINO_CHECK_OFFICIAL" ); ok {
0 commit comments