Commit 0b00c5b2 authored by Sandeep S. Shewalkar's avatar Sandeep S. Shewalkar
Browse files

Merge branch 'stagingbranch' into 'master'

Stagingbranch

See merge request !17
parents 6adf24d5 b84b6a2d
Branches
Tags
1 merge request!17Stagingbranch
Showing with 9 additions and 6 deletions
......@@ -2,7 +2,7 @@ package dalhelper
import (
"sync"
_ "github.com/go-sql-driver/mysql"
"corelab.mkcl.org/MKCLOS/coredevelopmentplatform/coreospackage/confighelper"
"github.com/gocraft/dbr"
......
......@@ -61,13 +61,15 @@ func mergeFiles(filename string, count int) {
fmt.Println("temp file name : " + tempFilename)
fmt.Println("file name : " + filename)
file, err := os.OpenFile(DownloadLocation+"/"+tempFilename, os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0666)
if err != nil {
log.Fatal(err)
}
defer file.Close()
for i := 0; i < count; i++ {
partFilename := DownloadLocation + "/temp/" + filename + "_" + strconv.Itoa(i)
file, err := os.OpenFile(DownloadLocation+"/"+tempFilename, os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0666)
if err != nil {
log.Fatal(err)
}
defer file.Close()
reader, err := ioutil.ReadFile(partFilename)
reader = reader[16:]
if err != nil {
......@@ -77,6 +79,7 @@ func mergeFiles(filename string, count int) {
log.Fatal(err)
}
}
file.Close()
os.Rename(DownloadLocation+"/"+tempFilename, DownloadLocation+"/"+filename)
}
func isDirEmpty(name string) (bool, error) {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment