From: qydysky Date: Tue, 25 Feb 2025 02:15:02 +0000 (+0800) Subject: 1 (#30) X-Git-Tag: v0.28.20250225021513 X-Git-Url: http://127.0.0.1:8081/?a=commitdiff_plain;h=9d6cb46d671aeb08d1fb0fc386b32b8c8f1da100;p=part%2F.git 1 (#30) * 1 * 1 --- diff --git a/file/FileWR.go b/file/FileWR.go index 3c39b97..f394213 100644 --- a/file/FileWR.go +++ b/file/FileWR.go @@ -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 diff --git a/file/FileWR_test.go b/file/FileWR_test.go index 8a8104d..3ab50d0 100644 --- a/file/FileWR_test.go +++ b/file/FileWR_test.go @@ -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)