images perchance?
This commit is contained in:
parent
22e2cc088c
commit
b46eefa34a
@ -73,6 +73,7 @@ func GetOrSetEnvKey(key string, defaultValue string) string {
|
|||||||
func extractZipToSiblingFolder(zipPath string) error {
|
func extractZipToSiblingFolder(zipPath string) error {
|
||||||
// Determine destination folder name (same name as zip file, without .zip)
|
// Determine destination folder name (same name as zip file, without .zip)
|
||||||
zipBase := strings.TrimSuffix(filepath.Base(zipPath), ".conj")
|
zipBase := strings.TrimSuffix(filepath.Base(zipPath), ".conj")
|
||||||
|
zipBase = strings.TrimSuffix(filepath.Base(zipBase), ".zip")
|
||||||
destDir := filepath.Join(filepath.Dir(zipPath), zipBase)
|
destDir := filepath.Join(filepath.Dir(zipPath), zipBase)
|
||||||
|
|
||||||
// Delete destination folder if it exists
|
// Delete destination folder if it exists
|
||||||
@ -186,14 +187,14 @@ func GetConjureGameInfo() []models.Game {
|
|||||||
newGames := readFolder(e, gamePath)
|
newGames := readFolder(e, gamePath)
|
||||||
games = append(newGames, games...)
|
games = append(newGames, games...)
|
||||||
} else if filepath.Ext(e.Name()) == ".conj" {
|
} else if filepath.Ext(e.Name()) == ".conj" {
|
||||||
zipPath := filepath.Join(gamePath, e.Name())
|
conjPath := filepath.Join(gamePath, e.Name())
|
||||||
r, err := zip.OpenReader(zipPath)
|
r, err := zip.OpenReader(conjPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
defer r.Close()
|
defer r.Close()
|
||||||
|
|
||||||
fmt.Println("Contents of", zipPath)
|
fmt.Println("Contents of", conjPath)
|
||||||
for _, f := range r.File {
|
for _, f := range r.File {
|
||||||
printIndentedPath(f.Name)
|
printIndentedPath(f.Name)
|
||||||
if f.Name == "metadata.txt" {
|
if f.Name == "metadata.txt" {
|
||||||
@ -206,6 +207,9 @@ func GetConjureGameInfo() []models.Game {
|
|||||||
fmt.Println("Contents of metadata.txt:")
|
fmt.Println("Contents of metadata.txt:")
|
||||||
metadata, err := io.ReadAll(rc)
|
metadata, err := io.ReadAll(rc)
|
||||||
game := parseGameInfo(metadata)
|
game := parseGameInfo(metadata)
|
||||||
|
conjBase := strings.TrimSuffix(filepath.Base(conjPath), ".conj")
|
||||||
|
game.ThumbnailPath = filepath.Join(conjBase, game.ThumbnailPath)
|
||||||
|
game.ImagePath = filepath.Join(conjBase, game.ImagePath)
|
||||||
games = append(games, game)
|
games = append(games, game)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user