From dc9fd4689f290718f596be0a77651db3d9ded2f4 Mon Sep 17 00:00:00 2001 From: comp500 Date: Sun, 16 Jun 2019 23:09:40 +0100 Subject: [PATCH] Improve optional stuff, add preserve flag --- core/index.go | 3 ++- core/mod.go | 9 +++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/core/index.go b/core/index.go index 9cbdc48..05b11eb 100644 --- a/core/index.go +++ b/core/index.go @@ -26,12 +26,13 @@ type Index struct { // IndexFile is a file in the index type IndexFile struct { - // Files are stored in relative forward-slash format to the index file + // Files are stored in forward-slash format relative to the index file File string `toml:"file"` Hash string `toml:"hash"` HashFormat string `toml:"hash-format,omitempty"` Alias string `toml:"alias,omitempty"` MetaFile bool `toml:"metafile,omitempty"` // True when it is a .toml metadata file + Preserve bool `toml:"preserve,omitempty"` // Don't overwrite the file when updating fileExistsTemp bool } diff --git a/core/mod.go b/core/mod.go index b69e9b2..6fdd801 100644 --- a/core/mod.go +++ b/core/mod.go @@ -16,11 +16,16 @@ type Mod struct { Name string `toml:"name"` FileName string `toml:"filename"` Side string `toml:"side,omitempty"` - Optional bool `toml:"optional,omitempty"` Download ModDownload `toml:"download"` // Update is a map of map of stuff, so you can store arbitrary values on string keys to define updating Update map[string]map[string]interface{} `toml:"update"` updateData map[string]interface{} + + Option *struct { + Optional bool `toml:"optional"` + Description string `toml:"description,omitempty"` + Default bool `toml:"default,omitempty"` + } `toml:"option,omitempty"` } // ModDownload specifies how to download the mod file @@ -95,4 +100,4 @@ func (m Mod) GetParsedUpdateData(updaterName string) (interface{}, bool) { // GetFilePath is a clumsy hack that I made because Mod already stores it's path anyway func (m Mod) GetFilePath() string { return m.metaFile -} \ No newline at end of file +}