Open tsubasaxZZZ opened 4 years ago
Could you pleaes try this?
editor = "notepad ${FILES}"
Sorry for my late reply. I tried but it failed. I've found pattern of sucess.
correct work:
memodir = "C:\\temp"
editor = "notepad"
dosen't work:
memodir = "C:\\Users\\tsunomur\\OneDrive - Microsoft\\memo"
memodir = "C:\\Users\\tsunomur\\OneDrive\\ -\\ Microsoft\\memo"
I used procmon to see this behavior, and then it's try to access C:\"C:\Users\tsunomur\OneDrive - Microsoft\memo\2020-06-18-hoge.md\
This memo command spawn executable editor
with cmd /c ...
. So the path contains spaces should be handled to be quoted.
cmd /c notepad "C:\Users\tsunomur\OneDrive - Microsoft\memo"
This quotes does not work when using notepad. Could you please this patch?
diff --git a/main.go b/main.go
index a6e5dc8..1b07ba3 100644
--- a/main.go
+++ b/main.go
@@ -414,7 +414,9 @@ func (cfg *config) runfilter(command string, r io.Reader, w io.Writer) error {
func (cfg *config) runcmd(command, pattern string, files ...string) error {
var args []string
for _, file := range files {
- args = append(args, shellquote(file))
+ if strings.ContainsRune(file, ' ') {
+ args = append(args, shellquote(file))
+ }
}
cmdargs := strings.Join(args, " ")
I patched but same error occured..
diff --git a/main.go b/main.go
index a6e5dc8..0056410 100644
--- a/main.go
+++ b/main.go
@@ -414,9 +414,12 @@ func (cfg *config) runfilter(command string, r io.Reader, w io.Writer) error {
func (cfg *config) runcmd(command, pattern string, files ...string) error {
var args []string
for _, file := range files {
- args = append(args, shellquote(file))
+ if strings.ContainsRune(file, ' ') {
+ args = append(args, shellquote(file))
+ }
}
cmdargs := strings.Join(args, " ")
+ fmt.Println(cmdargs)
$ go build
$ .\memo.exe new
Title: hoge
"C:\Users\tsunomur\OneDrive - Microsoft\memo\2020-06-18-hoge.md"
2020/06/18 16:16:40 notepad "C:\Users\tsunomur\OneDrive - Microsoft\memo\2020-06-18-hoge.md"
And when exec "config", it's openend blank notepad. It seem to need shellquote for other case.
Thank you for your cooperation. I'll investigate my situation continually and send PR.
I set following config:
When I'm trying "memo edit", and after select a file, I got following error(Sorry for only Japanese):
Could you let me know how to write a configuration file to open a file under such a folder? # I could open when remove call
shellquote(file)
but it's not correct solution...