154 lines
6.0 KiB
Diff
154 lines
6.0 KiB
Diff
diff -uNr a/go/pkg/mod/github.com/adrg/xdg@v0.4.0/internal/pathutil/pathutil_plan9_test.go b/go/pkg/mod/github.com/adrg/xdg@v0.4.0/internal/pathutil/pathutil_plan9_test.go
|
|
--- a/go/pkg/mod/github.com/adrg/xdg@v0.4.0/internal/pathutil/pathutil_plan9_test.go 2022-09-25 16:15:29.988786486 +0800
|
|
+++ b/go/pkg/mod/github.com/adrg/xdg@v0.4.0/internal/pathutil/pathutil_plan9_test.go 2022-09-25 16:18:53.668786408 +0800
|
|
@@ -26,8 +26,8 @@
|
|
require.Equal(t, home, pathutil.ExpandHome(home, home))
|
|
require.Equal(t, "/", pathutil.ExpandHome("~", "/"))
|
|
require.Equal(t, "/", pathutil.ExpandHome("$home", "/"))
|
|
- require.Equal(t, "/usr/bin", pathutil.ExpandHome("~/bin", "/usr"))
|
|
- require.Equal(t, "/usr/bin", pathutil.ExpandHome("$home/bin", "/usr"))
|
|
+ require.Equal(t, "@TERMUX_PREFIX@/bin", pathutil.ExpandHome("~/bin", "@TERMUX_PREFIX@"))
|
|
+ require.Equal(t, "@TERMUX_PREFIX@/bin", pathutil.ExpandHome("$home/bin", "@TERMUX_PREFIX@"))
|
|
}
|
|
|
|
func TestUnique(t *testing.T) {
|
|
diff -uNr a/go/pkg/mod/github.com/adrg/xdg@v0.4.0/internal/pathutil/pathutil_unix_test.go b/go/pkg/mod/github.com/adrg/xdg@v0.4.0/internal/pathutil/pathutil_unix_test.go
|
|
--- a/go/pkg/mod/github.com/adrg/xdg@v0.4.0/internal/pathutil/pathutil_unix_test.go 2022-09-25 16:15:29.988786486 +0800
|
|
+++ b/go/pkg/mod/github.com/adrg/xdg@v0.4.0/internal/pathutil/pathutil_unix_test.go 2022-09-25 16:18:53.668786408 +0800
|
|
@@ -26,8 +26,8 @@
|
|
require.Equal(t, home, pathutil.ExpandHome(home, home))
|
|
require.Equal(t, "/", pathutil.ExpandHome("~", "/"))
|
|
require.Equal(t, "/", pathutil.ExpandHome("$HOME", "/"))
|
|
- require.Equal(t, "/usr/bin", pathutil.ExpandHome("~/bin", "/usr"))
|
|
- require.Equal(t, "/usr/bin", pathutil.ExpandHome("$HOME/bin", "/usr"))
|
|
+ require.Equal(t, "@TERMUX_PREFIX@/bin", pathutil.ExpandHome("~/bin", "@TERMUX_PREFIX@"))
|
|
+ require.Equal(t, "@TERMUX_PREFIX@/bin", pathutil.ExpandHome("$HOME/bin", "@TERMUX_PREFIX@"))
|
|
}
|
|
|
|
func TestUnique(t *testing.T) {
|
|
diff -uNr a/go/pkg/mod/github.com/adrg/xdg@v0.4.0/paths_unix.go b/go/pkg/mod/github.com/adrg/xdg@v0.4.0/paths_unix.go
|
|
--- a/go/pkg/mod/github.com/adrg/xdg@v0.4.0/paths_unix.go 2022-09-25 16:15:29.998786486 +0800
|
|
+++ b/go/pkg/mod/github.com/adrg/xdg@v0.4.0/paths_unix.go 2022-09-25 17:51:22.581117569 +0800
|
|
@@ -6,7 +6,6 @@
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
- "strconv"
|
|
|
|
"github.com/adrg/xdg/internal/pathutil"
|
|
)
|
|
@@ -27,27 +26,27 @@
|
|
func initBaseDirs(home string) {
|
|
// Initialize standard directories.
|
|
baseDirs.dataHome = xdgPath(envDataHome, filepath.Join(home, ".local", "share"))
|
|
- baseDirs.data = xdgPaths(envDataDirs, "/usr/local/share", "/usr/share")
|
|
+ baseDirs.data = xdgPaths(envDataDirs, "@TERMUX_PREFIX@/share")
|
|
baseDirs.configHome = xdgPath(envConfigHome, filepath.Join(home, ".config"))
|
|
- baseDirs.config = xdgPaths(envConfigDirs, "/etc/xdg")
|
|
+ baseDirs.config = xdgPaths(envConfigDirs, "@TERMUX_PREFIX@/etc/xdg")
|
|
baseDirs.stateHome = xdgPath(envStateHome, filepath.Join(home, ".local", "state"))
|
|
baseDirs.cacheHome = xdgPath(envCacheHome, filepath.Join(home, ".cache"))
|
|
- baseDirs.runtime = xdgPath(envRuntimeDir, filepath.Join("/run/user", strconv.Itoa(os.Getuid())))
|
|
+ baseDirs.runtime = xdgPath(envRuntimeDir, "@TERMUX_PREFIX@/var/run")
|
|
|
|
// Initialize non-standard directories.
|
|
appDirs := []string{
|
|
filepath.Join(baseDirs.dataHome, "applications"),
|
|
filepath.Join(home, ".local/share/applications"),
|
|
- "/usr/local/share/applications",
|
|
- "/usr/share/applications",
|
|
+ "@TERMUX_PREFIX@/local/share/applications",
|
|
+ "@TERMUX_PREFIX@/share/applications",
|
|
}
|
|
|
|
fontDirs := []string{
|
|
filepath.Join(baseDirs.dataHome, "fonts"),
|
|
filepath.Join(home, ".fonts"),
|
|
filepath.Join(home, ".local/share/fonts"),
|
|
- "/usr/local/share/fonts",
|
|
- "/usr/share/fonts",
|
|
+ "@TERMUX_PREFIX@/local/share/fonts",
|
|
+ "@TERMUX_PREFIX@/share/fonts",
|
|
}
|
|
|
|
for _, dir := range baseDirs.data {
|
|
diff -uNr a/go/pkg/mod/github.com/adrg/xdg@v0.4.0/paths_unix_test.go b/go/pkg/mod/github.com/adrg/xdg@v0.4.0/paths_unix_test.go
|
|
--- a/go/pkg/mod/github.com/adrg/xdg@v0.4.0/paths_unix_test.go 2022-09-25 16:15:29.998786486 +0800
|
|
+++ b/go/pkg/mod/github.com/adrg/xdg@v0.4.0/paths_unix_test.go 2022-09-25 16:19:51.128786386 +0800
|
|
@@ -6,7 +6,6 @@
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
- "strconv"
|
|
"testing"
|
|
|
|
"github.com/adrg/xdg"
|
|
@@ -24,7 +23,7 @@
|
|
},
|
|
&envSample{
|
|
name: "XDG_DATA_DIRS",
|
|
- expected: []string{"/usr/local/share", "/usr/share"},
|
|
+ expected: []string{"@TERMUX_PREFIX@/share"},
|
|
actual: &xdg.DataDirs,
|
|
},
|
|
&envSample{
|
|
@@ -34,7 +33,7 @@
|
|
},
|
|
&envSample{
|
|
name: "XDG_CONFIG_DIRS",
|
|
- expected: []string{"/etc/xdg"},
|
|
+ expected: []string{"@TERMUX_PREFIX@/etc/xdg"},
|
|
actual: &xdg.ConfigDirs,
|
|
},
|
|
&envSample{
|
|
@@ -49,15 +48,15 @@
|
|
},
|
|
&envSample{
|
|
name: "XDG_RUNTIME_DIR",
|
|
- expected: filepath.Join("/run/user", strconv.Itoa(os.Getuid())),
|
|
+ expected: filepath.Join("@TERMUX_PREFIX@/var/run"),
|
|
actual: &xdg.RuntimeDir,
|
|
},
|
|
&envSample{
|
|
name: "XDG_APPLICATION_DIRS",
|
|
expected: []string{
|
|
filepath.Join(home, ".local/share/applications"),
|
|
- "/usr/local/share/applications",
|
|
- "/usr/share/applications",
|
|
+ "@TERMUX_PREFIX@/local/share/applications",
|
|
+ "@TERMUX_PREFIX@/share/applications",
|
|
},
|
|
actual: &xdg.ApplicationDirs,
|
|
},
|
|
@@ -66,8 +65,8 @@
|
|
expected: []string{
|
|
filepath.Join(home, ".local/share/fonts"),
|
|
filepath.Join(home, ".fonts"),
|
|
- "/usr/local/share/fonts",
|
|
- "/usr/share/fonts",
|
|
+ "@TERMUX_PREFIX@/local/share/fonts",
|
|
+ "@TERMUX_PREFIX@/share/fonts",
|
|
},
|
|
actual: &xdg.FontDirs,
|
|
},
|
|
@@ -86,8 +85,8 @@
|
|
},
|
|
&envSample{
|
|
name: "XDG_DATA_DIRS",
|
|
- value: "~/.local/data:/usr/share",
|
|
- expected: []string{filepath.Join(home, ".local/data"), "/usr/share"},
|
|
+ value: "~/.local/data:@TERMUX_PREFIX@/share",
|
|
+ expected: []string{filepath.Join(home, ".local/data"), "@TERMUX_PREFIX@/etc/xdg"},
|
|
actual: &xdg.DataDirs,
|
|
},
|
|
&envSample{
|
|
@@ -232,7 +231,7 @@
|
|
|
|
xdg.Reload()
|
|
require.Equal(t, "/", xdg.Home)
|
|
-
|
|
+
|
|
require.NoError(t, os.Setenv(envHomeVar, envHomeVal))
|
|
xdg.Reload()
|
|
require.Equal(t, envHomeVal, xdg.Home)
|