@@ -16,6 +16,7 @@ import (
1616
1717 "github.com/erizocosmico/gocloc"
1818 "github.com/sirupsen/logrus"
19+ "gopkg.in/src-d/core-retrieval.v0"
1920 "gopkg.in/src-d/core-retrieval.v0/model"
2021 "gopkg.in/src-d/core-retrieval.v0/repository"
2122 "gopkg.in/src-d/enry.v1"
@@ -485,17 +486,18 @@ func sivaFiles(inits map[model.SHA1]struct{}) []string {
485486var regSivaDir = regexp .MustCompile (`\b([0-9a-f]{40})_[0-9]{19}\b` )
486487
487488func sivaSize (init string ) (int64 , error ) {
488- info , err := ioutil .ReadDir ("/tmp/sourced" )
489+ tmpFS := core .TemporaryFilesystem ()
490+ info , err := tmpFS .ReadDir ("" )
489491 if err != nil {
490492 return - 1 , err
491493 }
492494
493495 if len (info ) != 1 || ! info [0 ].IsDir () {
494- return - 1 , fmt .Errorf ("/ tmp/sourced directory wasn't in a clean status" )
496+ return - 1 , fmt .Errorf ("tmp directory wasn't in a clean status" )
495497 }
496498
497- tmp := filepath .Join ("/tmp/sourced" , info [0 ].Name (), "transactioner" )
498- info , err = ioutil .ReadDir (tmp )
499+ tmp := filepath .Join (info [0 ].Name (), "transactioner" )
500+ info , err = tmpFS .ReadDir (tmp )
499501 if err != nil {
500502 return - 1 , err
501503 }
@@ -529,7 +531,7 @@ func sivaSize(init string) (int64, error) {
529531
530532 var size int64 = - 1
531533 for _ , path := range paths {
532- fi , err := os .Stat (path )
534+ fi , err := tmpFS .Stat (path )
533535 if err != nil {
534536 if os .IsNotExist (err ) {
535537 // a previous found siva file generated from
0 commit comments