feat: rename browser layout and add generics util function

This commit is contained in:
ᴍᴏᴏɴD4ʀᴋ committed 2022-04-17 16:42:36 +08:00
1 parent 6e05315ac6
commit 4551931c89
24 files changed
+1717 -244

No files matched your search

+36
View File
@@ -0,0 +1,36 @@
package fileutil
import (
"io/ioutil"
"os"
)
// FileExists checks if the file exists in the provided path
func FileExists(filename string) bool {
info, err := os.Stat(filename)
if os.IsNotExist(err) {
return false
}
if err != nil {
return false
}
return !info.IsDir()
}
// FolderExists checks if the folder exists
func FolderExists(foldername string) bool {
info, err := os.Stat(foldername)
if os.IsNotExist(err) {
return false
}
if err != nil {
return false
}
return info.IsDir()
}
// ReadFile reads the file from the provided path
func ReadFile(filename string) (string, error) {
s, err := ioutil.ReadFile(filename)
return string(s), err
}