mirror of
https://github.com/GopeedLab/gopeed.git
synced 2026-11-19 06:43:42 +00:00
feat: spool media inputs to disk and report producer progress (#1520)
This commit is contained in:
37 files changed
+1831
-375
No files matched your search
@@ -0,0 +1,26 @@
|
||||
package download
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/GopeedLab/gopeed/internal/tempfiles"
|
||||
)
|
||||
|
||||
// TempDir may be shared with the OS or other applications. Initialization never
|
||||
// removes its contents; shutdown only removes paths created by this downloader.
|
||||
func (d *Downloader) setupTempDir() error {
|
||||
if d.cfg.TempDir == "" {
|
||||
d.cfg.TempDir = os.TempDir()
|
||||
}
|
||||
root, err := filepath.Abs(d.cfg.TempDir)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err := os.MkdirAll(root, 0700); err != nil {
|
||||
return err
|
||||
}
|
||||
d.cfg.TempDir = root
|
||||
d.tempFiles = &tempfiles.Scope{}
|
||||
return nil
|
||||
}
|
||||
Reference in new issue
Block a user