mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-302727 [Repair Utility] - Crash if IDE is in non-ascii path
GitOrigin-RevId: a6486afd75c502444fac25585aeebe4e0732bcab
This commit is contained in:
committed by
intellij-monorepo-bot
parent
33f67df6ff
commit
a8fbaa5d0c
@@ -62,6 +62,7 @@ func initPath() {
|
||||
ideaBinary, err = helpers.SelectIdeaBinary()
|
||||
logger.ExitWithExceptionOnError(err)
|
||||
}
|
||||
helpers.CurrentIde.CheckIfPathIsAllowed(ideaBinary)
|
||||
helpers.CurrentIde.SetBinaryToWrokWith(ideaBinary)
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package helpers
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
@@ -11,6 +12,7 @@ import (
|
||||
"runtime"
|
||||
"strconv"
|
||||
"strings"
|
||||
"unicode"
|
||||
)
|
||||
|
||||
type IdeInfo struct {
|
||||
@@ -299,3 +301,18 @@ func (ide *IDE) RunIde() *os.Process {
|
||||
logger.DebugLogger.Println("Started the IDE with PID " + strconv.Itoa(cmd.Process.Pid))
|
||||
return cmd.Process
|
||||
}
|
||||
|
||||
func (ide *IDE) CheckIfPathIsAllowed(path string) {
|
||||
if !isASCII(path) {
|
||||
logger.FatalLogger.Fatal(errors.New("The path contains non-ASCII characters. IDE cannot run here: " + path))
|
||||
}
|
||||
}
|
||||
|
||||
func isASCII(s string) bool {
|
||||
for _, c := range s {
|
||||
if c > unicode.MaxASCII {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user