Skip to content

Commit

Permalink
chore: move classpath separator to platform dependent constant
Browse files Browse the repository at this point in the history
  • Loading branch information
mworzala committed Sep 16, 2023
1 parent 9889283 commit d5d37d0
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 11 deletions.
2 changes: 1 addition & 1 deletion internal/pkg/game/launch/launch.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func LaunchProfile(dataDir string, p *profile.Profile, acc *account.Account, acc
artifactPath := fmt.Sprintf("%s/%s/%s/%s-%s.jar", strings.ReplaceAll(groupId, ".", "/"), artifactName, version, artifactName, version)
classpath.WriteString(path.Join(librariesPath, artifactPath))
}
classpath.WriteString(platform.ClasspathSeparator())
classpath.WriteString(platform.ClasspathSeparator)
}

if spec.InheritsFrom != "" {
Expand Down
7 changes: 0 additions & 7 deletions internal/pkg/platform/platform.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,3 @@ func OpenUrl(url string) error {
func WriteToClipboard(text string) error {
return clipboard.WriteAll(text)
}

func ClasspathSeparator() string {
if runtime.GOOS == "windows" {
return ";"
}
return ":"
}
2 changes: 2 additions & 0 deletions internal/pkg/platform/platform_darwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

package platform

const ClasspathSeparator = ":"

func GetVersion() (string, error) {
return "unknown", nil
}
2 changes: 2 additions & 0 deletions internal/pkg/platform/platform_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

package platform

const ClasspathSeparator = ":"

func GetVersion() (string, error) {
return "unknown", nil
}
5 changes: 2 additions & 3 deletions internal/pkg/platform/platform_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@ package platform

import "golang.org/x/sys/windows/registry"

const (
NTCurrentVersionKey = `SOFTWARE\Microsoft\Windows NT\CurrentVersion`
)
const ClasspathSeparator = ";"

func GetVersion() (string, error) {
const NTCurrentVersionKey = `SOFTWARE\Microsoft\Windows NT\CurrentVersion`
k, err := registry.OpenKey(registry.LOCAL_MACHINE, NTCurrentVersionKey, registry.QUERY_VALUE)
if err != nil {
return "", err
Expand Down

0 comments on commit d5d37d0

Please sign in to comment.