Page Menu
Home
Musing Studio
Search
Configure Global Search
Log In
Files
F14175052
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Subscribers
None
View Options
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
Details
Attached
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
Attached To
rWCLI writeas-cli
Event Timeline
Log In to Comment