@@ -229,21 +229,12 @@ func DownloadRunOutput(run *types.Run, nodes map[string]NodeInfo, version *types
229229 runDir = strings .TrimSuffix (runDir , "Z" )
230230 runDir = strings .Replace (runDir , "T" , "-" , 1 )
231231 runDir = path .Join (destinationPath , runDir )
232- runDirPath := strings .Split (runDir , "/" )
233- toMerge := ""
234- for _ , dir := range runDirPath {
235- toMerge = path .Join (toMerge , dir )
236- dirInfo , err := os .Stat (toMerge )
237- dirExists := ! os .IsNotExist (err ) && dirInfo .IsDir ()
238232
239- if ! dirExists {
240- err = os .Mkdir (toMerge , 0755 )
241- if err != nil {
242- fmt .Println (err )
243- fmt .Println ("Couldn't create a directory to store run output!" )
244- os .Exit (0 )
245- }
246- }
233+ err := os .MkdirAll (runDir , 0755 )
234+ if err != nil {
235+ fmt .Println (err )
236+ fmt .Println ("Couldn't create a directory to store run output!" )
237+ os .Exit (0 )
247238 }
248239
249240 if len (nodes ) == 0 {
@@ -398,21 +389,11 @@ func getSubJobOutput(savePath string, subJob *types.SubJob, fetchData bool) []ty
398389
399390 if fileName != subJobOutputs .Results [i ].Path {
400391 subDirsPath := strings .TrimSuffix (subJobOutputs .Results [i ].Path , fileName )
401- subDirs := strings .Split (strings .Trim (subDirsPath , "/" ), "/" )
402- toMerge := savePath
403- for _ , subDir := range subDirs {
404- toMerge = path .Join (toMerge , subDir )
405- dirInfo , err := os .Stat (toMerge )
406- dirExists := ! os .IsNotExist (err ) && dirInfo .IsDir ()
407-
408- if ! dirExists {
409- err = os .Mkdir (toMerge , 0755 )
410- if err != nil {
411- fmt .Println (err )
412- fmt .Println ("Couldn't create a directory to store run output!" )
413- os .Exit (0 )
414- }
415- }
392+ err := os .MkdirAll (subDirsPath , 0755 )
393+ if err != nil {
394+ fmt .Println (err )
395+ fmt .Println ("Couldn't create a directory to store run output!" )
396+ os .Exit (0 )
416397 }
417398 fileName = subJobOutputs .Results [i ].Path
418399 }
0 commit comments