Skip to content

Commit

Permalink
fix: configuration key
Browse files Browse the repository at this point in the history
  • Loading branch information
ptma committed Jul 15, 2024
1 parent db93d1a commit 1a09849
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,34 +29,34 @@ func init() {
}

func main() {
webideExe := "webstorm64.exe"
webideVmOptionsFile := "webstorm64.exe.vmoptions"
ideaExe := "webstorm64.exe"
ideaVmOptionsFile := "webstorm64.exe.vmoptions"

utl.CreateFolder(app.DataPath)
app.Process = utl.PathJoin(app.AppPath, "bin", webideExe)
app.Process = utl.PathJoin(app.AppPath, "bin", ideaExe)
app.WorkingDir = utl.PathJoin(app.AppPath, "bin")

// override idea.properties
webidePropContent := strings.Replace(`# DO NOT EDIT! AUTOMATICALLY GENERATED BY PORTAPPS.
webide.config.path={{ DATA_PATH }}/config
webide.system.path={{ DATA_PATH }}/system
webide.plugins.path={{ DATA_PATH }}/plugins
webide.log.path={{ DATA_PATH }}/log`, "{{ DATA_PATH }}", utl.FormatUnixPath(app.DataPath), -1)
ideaPropContent := strings.Replace(`# DO NOT EDIT! AUTOMATICALLY GENERATED BY PORTAPPS.
idea.config.path={{ DATA_PATH }}/config
idea.system.path={{ DATA_PATH }}/system
idea.plugins.path={{ DATA_PATH }}/plugins
idea.log.path={{ DATA_PATH }}/log`, "{{ DATA_PATH }}", utl.FormatUnixPath(app.DataPath), -1)

webidePropPath := utl.PathJoin(app.DataPath, "idea.properties")
if err := utl.CreateFile(webidePropPath, webidePropContent); err != nil {
ideaPropPath := utl.PathJoin(app.DataPath, "idea.properties")
if err := utl.CreateFile(ideaPropPath, ideaPropContent); err != nil {
log.Fatal().Err(err).Msg("Cannot write idea.properties")
}

// https://www.jetbrains.com/help/webstorm/tuning-the-ide.html#configure-platform-properties
os.Setenv("WEBIDE_PROPERTIES", webidePropPath)
os.Setenv("WEBIDE_PROPERTIES", ideaPropPath)

// https://www.jetbrains.com/help/webstorm/tuning-the-ide.html#configure-jvm-options
os.Setenv("WEBIDE_VM_OPTIONS", utl.PathJoin(app.DataPath, vmOptionsFile))
if !utl.Exists(utl.PathJoin(app.DataPath, vmOptionsFile)) {
utl.CopyFile(utl.PathJoin(app.AppPath, "bin", webideVmOptionsFile), 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", webideVmOptionsFile))
utl.CopyFile(utl.PathJoin(app.DataPath, vmOptionsFile), utl.PathJoin(app.AppPath, "bin", ideaVmOptionsFile))
}

defer app.Close()
Expand Down

0 comments on commit 1a09849

Please sign in to comment.