From b1cbf3ae6b8c1ffd7738e59498c04e53da40aa0e Mon Sep 17 00:00:00 2001 From: CrazyMax Date: Thu, 4 Jul 2019 20:04:42 +0200 Subject: [PATCH] Allow to customize vmoptions (Issue #3) --- CHANGELOG.md | 4 ++++ main.go | 14 ++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9bf8e1e..33dd8e5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/main.go b/main.go index d6450aa..ff68e59 100644 --- a/main.go +++ b/main.go @@ -15,6 +15,10 @@ var ( app *App ) +const ( + vmOptionsFile = "idea.vmoptions" +) + func init() { var err error @@ -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) @@ -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:]) }