-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added config-generator example, fixed some shit
- Loading branch information
1 parent
304bc9d
commit 52030da
Showing
8 changed files
with
103 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
*.exe | ||
*.exe | ||
example-project/src/lfs.dll |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package main | ||
|
||
import ( | ||
"encoding/json" | ||
"fmt" | ||
"os" | ||
"path/filepath" | ||
) | ||
|
||
type Config struct { | ||
Main string `json:"main"` | ||
Out string `json:"out"` | ||
Modules map[string]string `json:"modules"` | ||
WatcherDelay float64 `json:"watcher_delay"` | ||
Constants map[string]interface{} `json:"const"` | ||
} | ||
|
||
const OUTPUT_CONFIG = "autogen-config.json" | ||
|
||
var cfg Config = Config{ | ||
Main: "src/init.lua", | ||
WatcherDelay: 250, | ||
Out: "dist/bundled.lua", | ||
Modules: map[string]string{}, | ||
Constants: map[string]interface{}{ | ||
"VERSION": "0.1-alpha", | ||
}, | ||
} | ||
|
||
func main() { | ||
fmt.Println("Generating config...") | ||
err := filepath.Walk("./src", func(path string, info os.FileInfo, e error) error { | ||
if !info.IsDir() && e == nil && path != cfg.Main { | ||
_, name := filepath.Split(path) | ||
cfg.Modules[name] = path | ||
fmt.Printf("Added module \"%s\"\n", path) | ||
} | ||
return nil | ||
}) | ||
if err != nil { | ||
panic(err) | ||
} | ||
bytes, err := json.Marshal(cfg) | ||
if err != nil { | ||
panic(err) | ||
} | ||
|
||
if err := os.WriteFile(OUTPUT_CONFIG, bytes, 0644); err != nil { | ||
panic("Error saving file:" + err.Error()) | ||
} | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters