Compare commits

...

2 Commits

Author SHA1 Message Date
de188c1b8f add methods to sessions 2023-02-01 22:56:35 +03:00
370efca124 add osutils 2023-02-01 16:31:46 +03:00
2 changed files with 66 additions and 0 deletions

41
osutils/files.go Normal file
View File

@ -0,0 +1,41 @@
package osutils
import (
"log"
"os"
"path/filepath"
)
func IsDirectory(path string) (bool, error) {
fileInfo, err := os.Stat(path)
if err != nil {
return false, err
}
return fileInfo.IsDir(), err
}
func RecursiceWalk(pathToWalk string) ([]string, error) {
paths := []string{}
err := filepath.Walk(pathToWalk,
func(path string, info os.FileInfo, err error) error {
if err != nil {
println(err)
return err
}
// fmt.Println(path[len(path)-4:])
libBool, err := IsDirectory(path)
if err != nil {
println("error in checking lib or dir")
}
if !libBool {
// println(path)
paths = append(paths, path)
}
return nil
})
if err != nil {
log.Println(err)
}
return paths, nil
}

View File

@ -20,6 +20,31 @@ type SkirdaSession interface {
type SkirdaSessions []SkirdaSession type SkirdaSessions []SkirdaSession
// GetGameId implements SkirdaSession
func (SkirdaSessions) GetGameId() string {
panic("unimplemented")
}
// GetGameType implements SkirdaSession
func (SkirdaSessions) GetGameType() string {
panic("unimplemented")
}
// GetSessionData implements SkirdaSession
func (SkirdaSessions) GetSessionData() string {
panic("unimplemented")
}
// GetSessionId implements SkirdaSession
func (SkirdaSessions) GetSessionId() string {
panic("unimplemented")
}
// GetUIAssets implements SkirdaSession
func (SkirdaSessions) GetUIAssets() SessionUIAssets {
panic("unimplemented")
}
type SessionUIAssets struct { type SessionUIAssets struct {
// GameID string `json:"gameId"` // GameID string `json:"gameId"`
Title string `json:"title"` Title string `json:"title"`