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:
parent
7c966756f0
commit
a0b79942f3
17
main.go
17
main.go
@ -164,12 +164,19 @@ func main() {
|
||||
createBuildDir()
|
||||
|
||||
// If dir is given create update for each file
|
||||
files, err := ioutil.ReadDir(appPath)
|
||||
if err == nil {
|
||||
for _, file := range files {
|
||||
createUpdate(filepath.Join(appPath, file.Name()), file.Name())
|
||||
fi, err := os.Stat(appPath)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user