Fixed Windows build
This commit is contained in:
23
utils.go
23
utils.go
@@ -12,24 +12,21 @@ import (
|
||||
)
|
||||
|
||||
type Project struct {
|
||||
EnginePath string `json:"enginePath"`
|
||||
EnginePath string `json:"enginePath"`
|
||||
ProjectPath string `json:"projectPath"`
|
||||
ProjectName string `json:"projectName"`
|
||||
Version string `json:"engineVersion"`
|
||||
Version string `json:"engineVersion"`
|
||||
}
|
||||
|
||||
func LoadProjects(projectFilePath string) ([]Project, error) {
|
||||
file, err := os.ReadFile(projectsFilePath)
|
||||
|
||||
file, err := os.ReadFile(projectFilePath)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var projects []Project
|
||||
if err := json.Unmarshal(file, &projects); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return projects, nil
|
||||
}
|
||||
|
||||
@@ -43,7 +40,7 @@ func removeDir(path string) {
|
||||
}
|
||||
|
||||
func CleanUnrealProject(project Project) {
|
||||
dirs := []string {
|
||||
dirs := []string{
|
||||
"Binaries",
|
||||
"DerivedDataCache",
|
||||
"Intermediate",
|
||||
@@ -75,17 +72,17 @@ func CleanUnrealProject(project Project) {
|
||||
|
||||
func GenerateUnrealSolution(project Project) {
|
||||
var buildCmd string
|
||||
|
||||
|
||||
switch runtime.GOOS {
|
||||
case "linux":
|
||||
buildCmd = project.EnginePath + "/Engine/Build/BatchFiles/Linux/GenerateProjectFiles.sh";
|
||||
case "linux":
|
||||
buildCmd = project.EnginePath + "/Engine/Build/BatchFiles/Linux/GenerateProjectFiles.sh"
|
||||
case "darwin":
|
||||
buildCmd = project.EnginePath + "/Engine/Build/BatchFiles/Mac/GenerateProjectFiles.sh"
|
||||
default:
|
||||
fmt.Println("Generate Project is not yet supported on Windows")
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
projectCmd := project.ProjectPath + "/" + project.ProjectName + ".uproject"
|
||||
cmd := exec.Command(buildCmd, projectCmd, "-game")
|
||||
|
||||
@@ -94,7 +91,7 @@ func GenerateUnrealSolution(project Project) {
|
||||
|
||||
func BuildUnrealSolution(project Project) {
|
||||
switch runtime.GOOS {
|
||||
case "linux":
|
||||
case "linux":
|
||||
cmd := exec.Command("make", "-C", project.ProjectPath, project.ProjectName)
|
||||
logToOutput(cmd)
|
||||
default:
|
||||
@@ -150,4 +147,4 @@ func logToOutput(cmd *exec.Cmd) {
|
||||
if err := cmd.Wait(); err != nil {
|
||||
fmt.Println("Error")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user