]> 127.0.0.1 Git - part/.git/commitdiff
1 (#30) v0.28.20250225021513
authorqydysky <qydysky@foxmail.com>
Tue, 25 Feb 2025 02:15:02 +0000 (10:15 +0800)
committerGitHub <noreply@github.com>
Tue, 25 Feb 2025 02:15:02 +0000 (10:15 +0800)
* 1

* 1

file/FileWR.go
file/FileWR_test.go

index 3c39b9743ca73f0079812eae649958aacb1f7986..f3942131151b157506bf1a24c27047096f71c801 100644 (file)
@@ -847,7 +847,7 @@ func (t *File) newPath(path string, mode fs.FileMode) {
        if !filepath.IsAbs(path) {
                rawPath, _ = os.Getwd()
        }
-       rawPs := strings.Split(path, string(os.PathSeparator))
+       rawPs := strings.Split(strings.ReplaceAll(path, `\`, `/`), `/`)
        for n, p := range rawPs {
                if p == "" || p == "." {
                        continue
index 8a8104d1e3f777fde0e61c83f1a9dc33160a2087..3ab50d0c70a9ff8f7bcbec5aeb6725dcaa314f6e 100644 (file)
@@ -29,6 +29,10 @@ func TestDirFs(t *testing.T) {
        }
 }
 
+func TestPathSeparator(t *testing.T) {
+       New("./testdata/l/0.txt", 0, false).Create()
+}
+
 func TestNewPath2(t *testing.T) {
        os.RemoveAll("./test")
        time.Sleep(time.Second)