1
0
mirror of https://github.com/taigrr/go-selfupdate synced 2025-01-18 04:33:12 -08:00

Added a check for file is directory

This commit is contained in:
Knut Ahlers 2015-05-23 19:42:42 +02:00
parent 7c966756f0
commit a0b79942f3

17
main.go
View File

@ -164,12 +164,19 @@ func main() {
createBuildDir() createBuildDir()
// If dir is given create update for each file // If dir is given create update for each file
files, err := ioutil.ReadDir(appPath) fi, err := os.Stat(appPath)
if err == nil { if err != nil {
for _, file := range files { panic(err)
createUpdate(filepath.Join(appPath, file.Name()), file.Name()) }
if fi.IsDir() {
files, err := ioutil.ReadDir(appPath)
if err == nil {
for _, file := range files {
createUpdate(filepath.Join(appPath, file.Name()), file.Name())
}
os.Exit(0)
} }
os.Exit(0)
} }
createUpdate(appPath, platform) createUpdate(appPath, platform)