-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support prerelease version numbers in nsis installer
- Loading branch information
1 parent
8300b8a
commit 6368ff7
Showing
5 changed files
with
65 additions
and
3 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
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,2 +1,3 @@ | ||
# Generated on each build | ||
wails_tools.nsh | ||
wails_tools.nsh | ||
vi_version.nsh |
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,50 @@ | ||
package main | ||
|
||
import ( | ||
"encoding/json" | ||
"fmt" | ||
"io" | ||
"os" | ||
"strings" | ||
|
||
"github.com/satisfactorymodding/SatisfactoryModManager/backend/projectfile" | ||
) | ||
|
||
var ( | ||
wailsJSONFilePath = "wails.json" | ||
viVersionFilePath = "build/windows/installer/vi_version.nsh" | ||
) | ||
|
||
func main() { | ||
wailsJSONFile, err := os.Open(wailsJSONFilePath) | ||
if err != nil { | ||
panic(err) | ||
} | ||
defer wailsJSONFile.Close() | ||
|
||
projectFile, err := io.ReadAll(wailsJSONFile) | ||
if err != nil { | ||
panic(err) | ||
} | ||
|
||
err = json.Unmarshal(projectFile, &projectfile.ProjectFile) | ||
if err != nil { | ||
panic(err) | ||
} | ||
|
||
f, err := os.OpenFile(viVersionFilePath, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0o777) | ||
if err != nil { | ||
panic(err) | ||
} | ||
defer f.Close() | ||
|
||
version, _, _ := strings.Cut(projectfile.ProjectFile.Info.ProductVersion, "-") | ||
version, _, _ = strings.Cut(version, "+") | ||
|
||
for strings.Count(version, ".") < 3 { | ||
version += ".0" | ||
} | ||
|
||
_, _ = f.WriteString("# DO NOT EDIT - Generated automatically by build/windows/installer_version.go\n\n") | ||
_, _ = f.WriteString(fmt.Sprintf("!define VI_VERSION \"%s\"\n", version)) | ||
} |
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,5 @@ | ||
//go:build tools | ||
|
||
package main | ||
|
||
//go:generate go run ./build/windows/installer_version.go |