MCPcopy
hub / github.com/safing/portmaster / GetFile

Method GetFile

service/updates/module.go:632–655  ·  view source on GitHub ↗

GetFile returns the path of a file given the name. Returns ErrNotFound if file is not found.

(name string)

Source from the content-addressed store, hash-verified

630
631// GetFile returns the path of a file given the name. Returns ErrNotFound if file is not found.
632func (u *Updater) GetFile(name string) (*Artifact, error) {
633 u.indexLock.Lock()
634 defer u.indexLock.Unlock()
635
636 // Check if any index is active.
637 if u.index == nil {
638 return nil, ErrNotFound
639 }
640
641 for _, artifact := range u.index.Artifacts {
642 switch {
643 case artifact.Filename != name:
644 // Name does not match.
645 case artifact.Platform != "" && artifact.Platform != u.cfg.Platform:
646 // Platform is defined and does not match.
647 // Platforms are usually pre-filtered, but just to be sure.
648 default:
649 // Artifact matches!
650 return artifact.export(u.cfg.Directory, u.index.versionNum), nil
651 }
652 }
653
654 return nil, ErrNotFound
655}
656
657// Stop stops the module.
658func (u *Updater) Stop() error {

Callers 10

GetBinaryUpdateFileMethod · 0.80
loadDLLMethod · 0.80
getUpdateResourceFunction · 0.80
startInterceptionFunction · 0.80
StartMethod · 0.80
broadcastNotifyFunction · 0.80
AvailableUpdateMethod · 0.80
updateListIndexFunction · 0.80
getUpgradableFilesFunction · 0.80
updateSPNIntelFunction · 0.80

Calls 3

LockMethod · 0.65
UnlockMethod · 0.65
exportMethod · 0.45

Tested by

no test coverage detected