mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-06-04 05:10:40 +00:00
Move Stat() into LocalPackagePool
The contents of `os.Stat` are rather fitted towards local package pools, but the method is in the generic PackagePool interface. This moves it to LocalPackagePool, and the use case of simply finding a file's size is delegated to a new, more generic PackagePool.Size() method. Signed-off-by: Ryan Gonzalez <ryan.gonzalez@collabora.com>
This commit is contained in:
committed by
André Roth
parent
8e37813129
commit
1ebd37f9ad
@@ -379,6 +379,15 @@ func (pool *PackagePool) Import(srcPath, basename string, checksums *utils.Check
|
||||
return poolPath, err
|
||||
}
|
||||
|
||||
func (pool *PackagePool) Size(path string) (size int64, err error) {
|
||||
stat, err := pool.Stat(path)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
return stat.Size(), nil
|
||||
}
|
||||
|
||||
// Open returns io.ReadCloser to access the file
|
||||
func (pool *PackagePool) Open(path string) (aptly.ReadSeekerCloser, error) {
|
||||
return os.Open(filepath.Join(pool.rootPath, path))
|
||||
|
||||
Reference in New Issue
Block a user