@@ -205,27 +205,9 @@ func fetchTools(runtime *config.Runtime, runtimesDirectory string, toolsDirector
205205 }
206206}
207207
208- func main () {
209- homePath , err := os .UserHomeDir ()
210- if err != nil {
211- log .Fatal (err )
212- }
213208
214- codacyDirectory := filepath .Join (homePath , ".cache" , "codacy" )
215- runtimesDirectory := filepath .Join (codacyDirectory , "runtimes" )
216- toolsDirectory := filepath .Join (codacyDirectory , "tools" )
217- fmt .Println ("creating: " + codacyDirectory )
218- if os .MkdirAll (codacyDirectory , 0777 ) != nil {
219- log .Fatal (err )
220- }
221- fmt .Println ("creating: " + runtimesDirectory )
222- if os .MkdirAll (runtimesDirectory , 0777 ) != nil {
223- log .Fatal (err )
224- }
225- fmt .Println ("creating: " + toolsDirectory )
226- if os .MkdirAll (toolsDirectory , 0777 ) != nil {
227- log .Fatal (err )
228- }
209+ func main () {
210+ config .Init ()
229211
230212 // TODO can use a variable to stored the "local" codacy dir
231213 runtimes , configErr := config .ReadConfigFile (filepath .Join (".codacy" , "codacy.yaml" ))
@@ -234,9 +216,9 @@ func main() {
234216 }
235217
236218 // install runtimes
237- fetchRuntimes (runtimes , runtimesDirectory )
219+ fetchRuntimes (runtimes , config . Config . RuntimesDirectory () )
238220 for _ , r := range runtimes {
239- fetchTools (r , runtimesDirectory , toolsDirectory )
221+ fetchTools (r , config . Config . RuntimesDirectory (), config . Config . ToolsDirectory () )
240222 }
241223
242224 cmd .Execute ()
0 commit comments