Compare commits

..

No commits in common. "fae7fac52cac5f7c1b3e55067944480120e9a3f2" and "eed78633aa4f2513cffc76efe8d1720b35008cf4" have entirely different histories.

4 changed files with 21 additions and 96 deletions

View file

@ -1,3 +1,6 @@
//go:build !android && !ios
// +build !android,!ios
package base
import (

View file

@ -5,6 +5,8 @@ import (
"os"
"runtime"
"golang.org/x/sys/windows"
"git.martyn.berlin/martyn/directories/base"
)
@ -20,7 +22,8 @@ func Audio() (string, error) {
return e, nil
}
case "windows":
return windowsAudio()
path, err := windows.KnownFolderPath(windows.FOLDERID_Music, 0)
return path, err
case "darwin":
h, err := Home()
return h + "/Music", err
@ -36,7 +39,8 @@ func Desktop() (string, error) {
return e, nil
}
case "windows":
return windowsDesktop()
path, err := windows.KnownFolderPath(windows.FOLDERID_Desktop, 0)
return path, err
case "darwin":
h, err := Home()
return h + "/Desktop", err
@ -52,7 +56,8 @@ func Documents() (string, error) {
return e, nil
}
case "windows":
return windowsDocuments()
path, err := windows.KnownFolderPath(windows.FOLDERID_Documents, 0)
return path, err
case "darwin":
h, err := Home()
return h + "/Documents", err
@ -68,7 +73,8 @@ func Downloads() (string, error) {
return e, nil
}
case "windows":
return windowsDownloads()
path, err := windows.KnownFolderPath(windows.FOLDERID_Downloads, 0)
return path, err
case "darwin":
h, err := Home()
return h + "/Downloads", err
@ -103,7 +109,8 @@ func Pictures() (string, error) {
return e, nil
}
case "windows":
return windowsPictures()
path, err := windows.KnownFolderPath(windows.FOLDERID_Pictures, 0)
return path, err
case "darwin":
h, err := Home()
return h + "/Pictures", err
@ -119,7 +126,8 @@ func Public() (string, error) {
return e, nil
}
case "windows":
return windowsPublic()
path, err := windows.KnownFolderPath(windows.FOLDERID_Public, 0)
return path, err
case "darwin":
h, err := Home()
return h + "/Public", err
@ -135,7 +143,8 @@ func Templates() (string, error) {
return e, nil
}
case "windows":
return windowsTemplates()
path, err := windows.KnownFolderPath(windows.FOLDERID_Templates, 0)
return path, err
case "darwin":
h, err := Home()
return h + "/Templates", err
@ -151,7 +160,8 @@ func Videos() (string, error) {
return e, nil
}
case "windows":
return windowsVideos()
path, err := windows.KnownFolderPath(windows.FOLDERID_Videos, 0)
return path, err
case "darwin":
h, err := Home()
return h + "/Videos", err

View file

@ -1,42 +0,0 @@
//go:build !windows
// +build !windows
package user
import "errors"
func wrongPlatform() (string, error) {
return "", errors.New("using windows call on non-windows system")
}
func windowsAudio() (string, error) {
return wrongPlatform()
}
func windowsDesktop() (string, error) {
return wrongPlatform()
}
func windowsDocuments() (string, error) {
return wrongPlatform()
}
func windowsDownloads() (string, error) {
return wrongPlatform()
}
func windowsPictures() (string, error) {
return wrongPlatform()
}
func windowsPublic() (string, error) {
return wrongPlatform()
}
func windowsTemplates() (string, error) {
return wrongPlatform()
}
func windowsVideos() (string, error) {
return wrongPlatform()
}

View file

@ -1,46 +0,0 @@
//go:build windows
// +build windows
package user
import "golang.org/x/sys/windows"
func windowsAudio() (string, error) {
path, err := windows.KnownFolderPath(windows.FOLDERID_Music, 0)
return path, err
}
func windowsDesktop() (string, error) {
path, err := windows.KnownFolderPath(windows.FOLDERID_Desktop, 0)
return path, err
}
func windowsDocuments() (string, error) {
path, err := windows.KnownFolderPath(windows.FOLDERID_Documents, 0)
return path, err
}
func windowsDownloads() (string, error) {
path, err := windows.KnownFolderPath(windows.FOLDERID_Downloads, 0)
return path, err
}
func windowsPictures() (string, error) {
path, err := windows.KnownFolderPath(windows.FOLDERID_Pictures, 0)
return path, err
}
func windowsPublic() (string, error) {
path, err := windows.KnownFolderPath(windows.FOLDERID_Public, 0)
return path, err
}
func windowsTemplates() (string, error) {
path, err := windows.KnownFolderPath(windows.FOLDERID_Templates, 0)
return path, err
}
func windowsVideos() (string, error) {
path, err := windows.KnownFolderPath(windows.FOLDERID_Videos, 0)
return path, err
}