21 lines
351 B
Go
21 lines
351 B
Go
|
package utils
|
||
|
|
||
|
import (
|
||
|
"os"
|
||
|
"path/filepath"
|
||
|
|
||
|
"git.ctrlz.es/mgdelacroix/birthdaybot/model"
|
||
|
)
|
||
|
|
||
|
func GetPictureForBirthday(birthday *model.Birthday, picturesDir string) (string, error) {
|
||
|
filename := birthday.Filename()
|
||
|
path := filepath.Join(picturesDir, filename)
|
||
|
|
||
|
_, err := os.Stat(path)
|
||
|
if err != nil {
|
||
|
return "", err
|
||
|
}
|
||
|
|
||
|
return path, nil
|
||
|
}
|