diff options
| author | James Mills <prologic@shortcircuit.net.au> | 2020-03-22 18:42:35 +1000 |
|---|---|---|
| committer | James Mills <prologic@shortcircuit.net.au> | 2020-03-22 18:42:35 +1000 |
| commit | 8ae65e4b73eb0d4269a7e0a50827df3d7d761481 (patch) | |
| tree | cfbcf46e5813b813dc851bfdb9cd1d2d50c5c0ee /utils | |
| parent | 7492a150ebf1d81782bd113140ad213354d6c107 (diff) | |
Don't generate new thumbnails if they already exist
Diffstat (limited to 'utils')
| -rw-r--r-- | utils/utils.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/utils/utils.go b/utils/utils.go index 0ca1cea..b7ab28f 100644 --- a/utils/utils.go +++ b/utils/utils.go @@ -3,10 +3,21 @@ package utils import ( "context" "fmt" + "os" "os/exec" "time" ) +// FileExists ... +func FileExists(name string) bool { + if _, err := os.Stat(name); err != nil { + if os.IsNotExist(err) { + return false + } + } + return true +} + // CmdExists ... func CmdExists(cmd string) bool { _, err := exec.LookPath(cmd) |
