mirror of
https://github.com/pikami/tiktok-dl.git
synced 2024-12-01 20:25:41 +00:00
22 lines
389 B
Go
22 lines
389 B
Go
|
package utils
|
||
|
|
||
|
import (
|
||
|
"os"
|
||
|
)
|
||
|
|
||
|
// CheckIfExists - Checks if file or directory exists
|
||
|
func CheckIfExists(path string) bool {
|
||
|
if _, err := os.Stat(path); os.IsNotExist(err) {
|
||
|
return false
|
||
|
}
|
||
|
|
||
|
return true
|
||
|
}
|
||
|
|
||
|
// InitOutputDirectory - Creates output directory
|
||
|
func InitOutputDirectory(path string) {
|
||
|
if _, err := os.Stat(path); os.IsNotExist(err) {
|
||
|
os.MkdirAll(path, os.ModePerm)
|
||
|
}
|
||
|
}
|