mirror of https://github.com/lapce/lapce.git
set path
This commit is contained in:
parent
135900c1f2
commit
ad8ca95267
|
@ -2,19 +2,29 @@ package main
|
|||
|
||||
import (
|
||||
"net/http"
|
||||
"os"
|
||||
|
||||
_ "net/http/pprof"
|
||||
|
||||
"github.com/crane-editor/crane/editor"
|
||||
"github.com/crane-editor/crane/log"
|
||||
)
|
||||
|
||||
func main() {
|
||||
os.Setenv("PATH", "/Users/Lulu/.cargo/bin:/Users/Lulu/go/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/local/bin:/opt/local/sbin")
|
||||
go func() {
|
||||
http.ListenAndServe("localhost:6020", nil)
|
||||
}()
|
||||
file, err := os.OpenFile("/Users/Lulu/.crane/log", os.O_APPEND|os.O_WRONLY|os.O_CREATE, 0666)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
log.Base().SetOutput(file)
|
||||
editor, err := editor.NewEditor()
|
||||
if err != nil {
|
||||
log.Errorln(err)
|
||||
return
|
||||
}
|
||||
log.Infoln("now run editor")
|
||||
editor.Run()
|
||||
}
|
||||
|
|
|
@ -147,6 +147,11 @@ func NewEditor() (*Editor, error) {
|
|||
if err == nil {
|
||||
e.homeDir = user.HomeDir
|
||||
}
|
||||
log.Infoln("current wd is", e.cwd)
|
||||
if e.cwd == "/" {
|
||||
e.cwd = e.homeDir
|
||||
os.Chdir(e.homeDir)
|
||||
}
|
||||
loadKeymap(e)
|
||||
e.initSpecialKeys()
|
||||
e.states = newStates(e)
|
||||
|
@ -306,7 +311,9 @@ func NewEditor() (*Editor, error) {
|
|||
e.xi.Conn.Close()
|
||||
})
|
||||
e.clipboard = e.app.Clipboard()
|
||||
log.Infoln("init main window")
|
||||
e.initMainWindow()
|
||||
log.Infoln("init main window done")
|
||||
|
||||
return e, nil
|
||||
}
|
||||
|
@ -490,7 +497,7 @@ func (e *Editor) initMainWindow() {
|
|||
mainSplitter.AddWidget(e.diagnosticsPanel.view)
|
||||
e.mainSplitter = mainSplitter
|
||||
e.diagnosticsPanel.height = 250
|
||||
e.mainSplitter.SetSizes([]int{ e.height - e.diagnosticsPanel.height,e.diagnosticsPanel.height,})
|
||||
e.mainSplitter.SetSizes([]int{e.height - e.diagnosticsPanel.height, e.diagnosticsPanel.height})
|
||||
e.mainSplitter.ConnectSplitterMoved(func(pos, index int) {
|
||||
e.diagnosticsPanel.view.Hide()
|
||||
e.diagnosticsPanel.view.Show()
|
||||
|
|
|
@ -43,7 +43,7 @@ func NewPlugin() *Plugin {
|
|||
|
||||
// Run is
|
||||
func (p *Plugin) Run() {
|
||||
file, err := os.OpenFile("/tmp/log", os.O_APPEND|os.O_WRONLY, 0666)
|
||||
file, err := os.OpenFile("/tmp/log", os.O_APPEND|os.O_WRONLY|os.O_CREATE, 0666)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue