feat: added sorting of recently opened remeber paths
This commit is contained in:
parent
8cef2527d6
commit
6506df75b4
26
README.md
26
README.md
@ -1,16 +1,14 @@
|
|||||||
# README
|
# RAILGUN
|
||||||
|
|
||||||
## About
|
# Building
|
||||||
|
```bash
|
||||||
|
wails build
|
||||||
|
```
|
||||||
|
|
||||||
This is the official Wails Svelte-TS template.
|
# Remebering paths
|
||||||
|
```bash
|
||||||
## Live Development
|
# this will save the current path in railgun for easy acess
|
||||||
|
railgun --remeber
|
||||||
To run in live development mode, run `wails dev` in the project directory. This will run a Vite development
|
# and this will forget the current path
|
||||||
server that will provide very fast hot reload of your frontend changes. If you want to develop in a browser
|
railgun --forget
|
||||||
and have access to your Go methods, there is also a dev server that runs on http://localhost:34115. Connect
|
```
|
||||||
to this in your browser, and you can call your Go code from devtools.
|
|
||||||
|
|
||||||
## Building
|
|
||||||
|
|
||||||
To build a redistributable, production mode package, use `wails build`.
|
|
||||||
|
26
app.go
26
app.go
@ -187,11 +187,37 @@ func (a *App) Enter(value string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (a *App) EnterDir(value string) {
|
func (a *App) EnterDir(value string) {
|
||||||
|
updateRemeberPath(a, value)
|
||||||
fmt.Printf("ghostty --working-directory=%s", value)
|
fmt.Printf("ghostty --working-directory=%s", value)
|
||||||
runtime.Quit(a.ctx)
|
runtime.Quit(a.ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *App) OpenEditor(value string) {
|
func (a *App) OpenEditor(value string) {
|
||||||
|
updateRemeberPath(a, value)
|
||||||
fmt.Printf("czed %s", value)
|
fmt.Printf("czed %s", value)
|
||||||
runtime.Quit(a.ctx)
|
runtime.Quit(a.ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func updateRemeberPath(a *App, value string) {
|
||||||
|
if a.remeberedPath[0] != value {
|
||||||
|
remeberPath, err := GetRemeberPath()
|
||||||
|
if err != nil {
|
||||||
|
os.Exit(1)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
nlist := []string{value}
|
||||||
|
|
||||||
|
for _, elm := range a.remeberedPath {
|
||||||
|
if value != elm {
|
||||||
|
nlist = append(nlist, elm)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
err = os.WriteFile(remeberPath, []byte(strings.Join(nlist, "\n")), 0644)
|
||||||
|
if err != nil {
|
||||||
|
os.Exit(1)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user