Page MenuHomeMusing Studio

No OneTemporary

diff --git a/posts.go b/posts.go
index b9a763a..7aa9581 100644
--- a/posts.go
+++ b/posts.go
@@ -1,38 +1,39 @@
package main
import (
"fmt"
"github.com/writeas/writeas-cli/utils"
"os"
+ "path/filepath"
)
const (
POSTS_FILE = "posts.psv"
SEPARATOR = `|`
)
func userDataDir() string {
- return fmt.Sprintf("%s/%s", parentDataDir(), DATA_DIR_NAME)
+ return filepath.Join(parentDataDir(), DATA_DIR_NAME)
}
func dataDirExists() bool {
return fileutils.Exists(userDataDir())
}
func createDataDir() {
os.Mkdir(userDataDir(), 0700)
}
func addPost(id, token string) {
- f, err := os.OpenFile(userDataDir()+"/"+POSTS_FILE, os.O_WRONLY|os.O_APPEND|os.O_CREATE, 0600)
+ f, err := os.OpenFile(filepath.Join(userDataDir(), POSTS_FILE), os.O_WRONLY|os.O_APPEND|os.O_CREATE, 0600)
if err != nil {
panic(err)
}
defer f.Close()
l := fmt.Sprintf("%s%s%s\n", id, SEPARATOR, token)
if _, err = f.WriteString(l); err != nil {
panic(err)
}
}
diff --git a/posts_win.go b/posts_win.go
index d52c613..3166372 100644
--- a/posts_win.go
+++ b/posts_win.go
@@ -1,14 +1,13 @@
// +build windows
package main
import (
- "github.com/luisiturrios/gowin"
+ "os"
)
const DATA_DIR_NAME = "Write.as"
func parentDataDir() string {
- folders := gowin.ShellFolders{gowin.USER}
- return folders.AppData()
+ return os.Getenv("APPDATA")
}

File Metadata

Mime Type
text/x-diff
Expires
Thu, Apr 2, 4:36 AM (1 d, 8 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3679278

Event Timeline