added logging config
This commit is contained in:
parent
2bbb4b8cf0
commit
3720f1e524
@ -169,6 +169,7 @@ func (i *InstanceManager)InstallVanilla(version string, instanceName string) {
|
||||
fmt.Printf("Libs Downloaded")
|
||||
}
|
||||
InstallNatives(version, filepath.Join(dir, "FCLauncher", "instances", instanceName, "minecraft", "natives"))
|
||||
DownloadLoggingConfig(version, filepath.Join(dir, "FCLauncher", "instances", instanceName, "minecraft"))
|
||||
err = DownloadExecutable(version, filepath.Join(dir, "FCLauncher", "bin"), *i.app)
|
||||
if err != nil {
|
||||
fmt.Printf("Unable to download binaries: %s\n", err)
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
@ -93,6 +93,15 @@ type McDownload struct {
|
||||
Url string
|
||||
}
|
||||
|
||||
type McLogging struct {
|
||||
Client McLoggingClient
|
||||
}
|
||||
|
||||
type McLoggingClient struct {
|
||||
Argument string
|
||||
File McDownload
|
||||
}
|
||||
|
||||
type McMetadata struct {
|
||||
Arguments McArguments
|
||||
AssetIndex McAssetIndex
|
||||
@ -102,13 +111,13 @@ type McMetadata struct {
|
||||
Id string
|
||||
JavaVersion McJavaVersion
|
||||
Libraries []McLibrary
|
||||
Logging interface{}
|
||||
MainClass string
|
||||
MinimumLauncherVersion int
|
||||
ReleaseTime time.Time
|
||||
Time time.Time
|
||||
Type string
|
||||
MinecraftArguments string
|
||||
Logging McLogging
|
||||
}
|
||||
|
||||
func GetVersionManifest() (McVersionManifest, error) {
|
||||
@ -437,6 +446,19 @@ func InstallNatives(mcVersion string, nativesDir string){
|
||||
}
|
||||
}
|
||||
|
||||
func DownloadLoggingConfig(mcVersion string, gameDir string){
|
||||
metadata, _ := GetVersionMetadata(mcVersion)
|
||||
resp, err := http.Get(metadata.Logging.Client.File.Url)
|
||||
if err != nil {
|
||||
fmt.Printf("Error downloading logging config: %s\n", err)
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
os.MkdirAll(gameDir, 0755)
|
||||
f, _ := os.OpenFile(filepath.Join(gameDir, "log4j2.xml"), os.O_CREATE|os.O_RDWR, 0755)
|
||||
defer f.Close()
|
||||
io.Copy(f, resp.Body)
|
||||
}
|
||||
|
||||
func DownloadExecutable(mcVersion string, binDir string, a App) error {
|
||||
metadata, err := GetVersionMetadata(mcVersion)
|
||||
if err != nil {
|
||||
@ -512,6 +534,7 @@ func GetBaseLaunchArgs(mcVersion string, libDir string, binDir string, assetDir
|
||||
args = append(args, "-Djna.tmpdir="+filepath.Join(gameDir, "natives"))
|
||||
args = append(args, "-Dorg.lwjgl.system.SharedLibraryExtractpath="+filepath.Join(gameDir, "natives"))
|
||||
args = append(args, "-Dio.netty.native.workdir="+filepath.Join(gameDir, "natives"))
|
||||
args = append(args, strings.ReplaceAll(metadata.Logging.Client.Argument, "${path}", filepath.Join(gameDir, "log4j2.xml")))
|
||||
args = append(args, "-Xms512m")
|
||||
args = append(args, "-Xmx1024m")
|
||||
args = append(args, "-cp")
|
||||
|
Loading…
Reference in New Issue
Block a user