Beispiel #1
0
func (a *Agent) TorrentExist(id string, typee string) (exist bool, path string, err error) {
	switch typee {
	case "image":
		path = filepath.Join(a.DataDir, "torrent", "image", id+".torrent")
	case "layer":
		path = filepath.Join(a.DataDir, "torrent", "layer", id+".torrent")
	case "multi_layer":
		path = filepath.Join(a.DataDir, "torrent", "multi_layer", id+".torrent")
	}
	exist, err = utils.FileExist(path)
	return
}
Beispiel #2
0
func (m *Manager) TorrentExist(id string, typee string) (exist bool, path string, err error) {
	switch typee {
	case "image":
		path = filepath.Join(m.DataDir, "torrent", "image", id+".torrent")
	case "layer":
		path = filepath.Join(m.DataDir, "torrent", "layer", id+".torrent")
	case "multi_layer":
		path = filepath.Join(m.DataDir, "torrent", "multi_layer", id+".torrent")
	default:
		err = errors.New("unsupport type")
	}
	exist, err = utils.FileExist(path)
	return
}