mirror of
https://github.com/schollz/croc.git
synced 2025-10-11 13:21:00 +02:00
fix file
This commit is contained in:
parent
8eba192a22
commit
0804b04e6a
2 changed files with 7 additions and 6 deletions
1
go.mod
1
go.mod
|
@ -7,6 +7,7 @@ require (
|
|||
github.com/mattn/go-colorable v0.1.1
|
||||
github.com/pion/webrtc/v2 v2.0.2
|
||||
github.com/pions/webrtc v1.2.1-0.20190404195536-1202dbaa06ad
|
||||
github.com/pkg/errors v0.8.1
|
||||
github.com/schollz/mnemonicode v1.0.1
|
||||
github.com/schollz/pake v1.1.0
|
||||
github.com/schollz/progressbar/v2 v2.11.0
|
||||
|
|
|
@ -141,16 +141,16 @@ func (s *Session) receiveData(pathToFile string, fileSize int64) error {
|
|||
stat, _ := f.Stat()
|
||||
truncate = stat.Size() != fileSize
|
||||
} else {
|
||||
f, err := os.Create(pathToFile)
|
||||
if err != nil {
|
||||
err = errors.Wrap(err, "could not create "+pathToFile)
|
||||
log.Error(err)
|
||||
return err
|
||||
f, errOpen = os.Create(pathToFile)
|
||||
if errOpen != nil {
|
||||
errOpen = errors.Wrap(errOpen, "could not create "+pathToFile)
|
||||
log.Error(errOpen)
|
||||
return errOpen
|
||||
}
|
||||
truncate = true
|
||||
}
|
||||
|
||||
if trucnate {
|
||||
if truncate {
|
||||
err := f.Truncate(fileSize)
|
||||
if err != nil {
|
||||
err = errors.Wrap(err, "could not truncate "+pathToFile)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue