Skip to content

Commit

Permalink
Allow to customize vmoptions (Issue #3)
Browse files Browse the repository at this point in the history
  • Loading branch information
crazy-max committed Jul 4, 2019
1 parent b1857a8 commit b1cbf3a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 2019.1.3-8 (2019/07/04)

* Allow to customize vmoptions (Issue #3)

## 2019.1.3-7 (2019/05/28)

* IntelliJ IDEA Ultimate 2019.1.3
Expand Down
14 changes: 14 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ var (
app *App
)

const (
vmOptionsFile = "idea.vmoptions"
)

func init() {
var err error

Expand All @@ -26,8 +30,10 @@ func init() {

func main() {
ideaExe := "idea.exe"
ideaVmOptionsFile := "idea.exe.vmoptions"
if runtime.GOARCH == "amd64" {
ideaExe = "idea64.exe"
ideaVmOptionsFile = "idea64.exe.vmoptions"
}

utl.CreateFolder(app.DataPath)
Expand All @@ -49,5 +55,13 @@ idea.log.path={{ DATA_PATH }}/log`, "{{ DATA_PATH }}", utl.FormatUnixPath(app.Da
// https://www.jetbrains.com/help/idea/tuning-intellij-idea.html#configure-platform-properties
utl.OverrideEnv("IDEA_PROPERTIES", ideaPropPath)

// https://www.jetbrains.com/help/idea/tuning-the-ide.html#configure-jvm-options
utl.OverrideEnv("IDEA_VM_OPTIONS", utl.PathJoin(app.DataPath, vmOptionsFile))
if !utl.Exists(utl.PathJoin(app.DataPath, vmOptionsFile)) {
utl.CopyFile(utl.PathJoin(app.AppPath, "bin", ideaVmOptionsFile), utl.PathJoin(app.DataPath, vmOptionsFile))
} else {
utl.CopyFile(utl.PathJoin(app.DataPath, vmOptionsFile), utl.PathJoin(app.AppPath, "bin", ideaVmOptionsFile))
}

app.Launch(os.Args[1:])
}

0 comments on commit b1cbf3a

Please sign in to comment.