mirror of
https://github.com/mickael-menu/zk
synced 2024-11-11 07:10:25 +00:00
Fix Windows build (#171)
This commit is contained in:
parent
e037befdf1
commit
83c15cc927
3
.gitignore
vendored
3
.gitignore
vendored
@ -14,5 +14,8 @@
|
|||||||
# Dependency directories (remove the comment below to include it)
|
# Dependency directories (remove the comment below to include it)
|
||||||
# vendor/
|
# vendor/
|
||||||
|
|
||||||
|
# IDEs/Editors
|
||||||
|
.vscode/
|
||||||
|
|
||||||
notebook.db
|
notebook.db
|
||||||
zk
|
zk
|
||||||
|
@ -152,7 +152,8 @@ func (ns *NotebookStore) locateNotebook(path string) (string, error) {
|
|||||||
|
|
||||||
var locate func(string) (string, error)
|
var locate func(string) (string, error)
|
||||||
locate = func(currentPath string) (string, error) {
|
locate = func(currentPath string) (string, error) {
|
||||||
if currentPath == "/" || currentPath == "." {
|
// For Windows, the root dir may end with volume name, e.g. E:\\
|
||||||
|
if currentPath == "/" || currentPath == filepath.VolumeName(currentPath)+"\\" || currentPath == "." {
|
||||||
return "", ErrNotebookNotFound(path)
|
return "", ErrNotebookNotFound(path)
|
||||||
}
|
}
|
||||||
exists, err := ns.fs.DirExists(filepath.Join(currentPath, ".zk"))
|
exists, err := ns.fs.DirExists(filepath.Join(currentPath, ".zk"))
|
||||||
|
@ -3,15 +3,16 @@ package exec
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
|
"strings"
|
||||||
"syscall"
|
"syscall"
|
||||||
)
|
)
|
||||||
|
|
||||||
// CommandFromString returns a Cmd running the given command.
|
// CommandFromString returns a Cmd running the given command.
|
||||||
func CommandFromString(command string) *exec.Cmd {
|
func CommandFromString(command string, args ...string) *exec.Cmd {
|
||||||
cmd := exec.Command("cmd")
|
cmd := exec.Command("cmd")
|
||||||
cmd.SysProcAttr = &syscall.SysProcAttr{
|
cmd.SysProcAttr = &syscall.SysProcAttr{
|
||||||
HideWindow: false,
|
HideWindow: false,
|
||||||
CmdLine: fmt.Sprintf(` /v:on/s/c "%s"`, command),
|
CmdLine: fmt.Sprintf(` /v:on/s/c "%s %s"`, command, strings.Join(args[:], " ")),
|
||||||
CreationFlags: 0,
|
CreationFlags: 0,
|
||||||
}
|
}
|
||||||
return cmd
|
return cmd
|
||||||
|
Loading…
Reference in New Issue
Block a user