Actually fixed doc.Dump

This commit is contained in:
Unknown
2018-09-02 11:55:36 -04:00
parent 86a428abe0
commit 84039eb788
2 changed files with 4 additions and 4 deletions

View File

@@ -202,17 +202,16 @@ func (d *Document) DumpFile() string {
log.Println(err) log.Println(err)
} }
path := filepath.Join(strings.Replace(d.fullName, "~", usr.HomeDir, 1)) path := filepath.Join(strings.Replace(d.fullName, "~", usr.HomeDir, 1))
path = strings.Replace(path, `/`, `\`, -1)
path = strings.TrimPrefix(path, `\`) path = strings.TrimPrefix(path, `\`)
path = strings.Replace(path, `[^:]\`, `:\`, 1) path = strings.Replace(path, `\`, `:\`, 1)
drive := filepath.VolumeName(path)
path = strings.Replace(path, drive, strings.ToUpper(drive), 1)
return strings.Replace(path, ".psd", ".json", 1) return strings.Replace(path, ".psd", ".json", 1)
} }
// Dump saves the document to disk in JSON format. // Dump saves the document to disk in JSON format.
func (d *Document) Dump() { func (d *Document) Dump() {
log.Println("Dumping to disk") log.Println("Dumping to disk")
log.Println(d.DumpFile()) log.Println(d.DumpFile(), d.FullName())
defer d.Save() defer d.Save()
f, err := os.Create(d.DumpFile()) f, err := os.Create(d.DumpFile())
if err != nil { if err != nil {

View File

@@ -17,6 +17,7 @@ import (
// Windows is the runner Windows Operating Systems. // Windows is the runner Windows Operating Systems.
// It runs Visual Basic Scripts. // It runs Visual Basic Scripts.
// // TODO(sbrow): Separate 32 and 64 bit Windows runners.
var Windows = Runner{ var Windows = Runner{
Cmd: "cscript.exe", Cmd: "cscript.exe",
Args: []string{"/nologo"}, Args: []string{"/nologo"},