diff --git a/ioutil2/ioutil.go b/ioutil2/ioutil.go index ce2b1b8..c99c987 100644 --- a/ioutil2/ioutil.go +++ b/ioutil2/ioutil.go @@ -31,3 +31,9 @@ func WriteFileAtomic(filename string, data []byte, perm os.FileMode) error { } return os.Rename(f.Name(), filename) } + +// Check file exists or not +func FileExists(name string) bool { + _, err := os.Stat(name) + return !os.IsNotExist(err) +} diff --git a/io2/sectionwriter.go b/ioutil2/sectionwriter.go similarity index 98% rename from io2/sectionwriter.go rename to ioutil2/sectionwriter.go index 3d3cd62..c02ab0d 100644 --- a/io2/sectionwriter.go +++ b/ioutil2/sectionwriter.go @@ -1,4 +1,4 @@ -package io2 +package ioutil2 import ( "errors" diff --git a/io2/sectionwriter_test.go b/ioutil2/sectionwriter_test.go similarity index 97% rename from io2/sectionwriter_test.go rename to ioutil2/sectionwriter_test.go index 66b759c..35bf6d7 100644 --- a/io2/sectionwriter_test.go +++ b/ioutil2/sectionwriter_test.go @@ -1,4 +1,4 @@ -package io2 +package ioutil2 import ( "io/ioutil"