Hello, Is there a way to set up a vfs.NameSpace filesystem backed up by Windows filesystem without specific root, something like:
ns.Open("C:\\foo\\bar") => content of C:\foo\bar ns.Open("D:\\qux") => content of D:\qux and so on. Why do I need it? Imagine a local file system backed by in-memory map (pretty common scenario in language server protocol where some files may be read directly from disk and some may be provided by a client while being edited). Sometimes it's impossible to predict what parts of local file system may be needed and caller may be unable to declare all the potential mount points. fs.Bind("/", vfs.OS("/"), "/", vfs.BindBefore) does not work on Windows because it resolves all the paths into \PATH and Windows FS is unable to access such a file. I think it's may be worth to add such a possibility and resolve paths on Windows specific way (remove "\" prefix if there is any). What do you think? Test case that fails on Windows package vfs_test import ( "io/ioutil" "os" "path/filepath" "testing" "golang.org/x/tools/godoc/vfs" "golang.org/x/tools/godoc/vfs/mapfs" ) func TestOpen(t *testing.T) { tmpDir, err := ioutil.TempDir("", "vfs-localfs") if err != nil { t.Fatal(err) } defer os.RemoveAll(tmpDir) if err = os.MkdirAll(tmpDir, 0700); err != nil { t.Fatal(err) } file := filepath.Join(tmpDir, "foo") if err = ioutil.WriteFile(file, []byte("bar"), 0600); err != nil { t.Fatal(err) } fs := vfs.NameSpace{} fs.Bind("/", vfs.OS("/"), "/", vfs.BindAfter) _, err = fs.Open(file) if err != nil { t.Errorf("Cannot read local file (%s)", err) } } I can come with a pull request if needed. Regards, Alex -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.