aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/shurcooL/httpfs/vfsutil/file.go
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2018-07-16 23:20:23 +0200
committerMichael Muré <batolettre@gmail.com>2018-07-16 23:23:43 +0200
commit1d678dfdfa026968dbb19795c9bed16385603b21 (patch)
treecac862609d0103ee30da39cd0054b11884248e9d /vendor/github.com/shurcooL/httpfs/vfsutil/file.go
parent131a862d313f12808d63e832126317a27226940b (diff)
downloadgit-bug-1d678dfdfa026968dbb19795c9bed16385603b21.tar.gz
vendor dependencies with dep
Diffstat (limited to 'vendor/github.com/shurcooL/httpfs/vfsutil/file.go')
-rw-r--r--vendor/github.com/shurcooL/httpfs/vfsutil/file.go21
1 files changed, 21 insertions, 0 deletions
diff --git a/vendor/github.com/shurcooL/httpfs/vfsutil/file.go b/vendor/github.com/shurcooL/httpfs/vfsutil/file.go
new file mode 100644
index 00000000..4cb0dada
--- /dev/null
+++ b/vendor/github.com/shurcooL/httpfs/vfsutil/file.go
@@ -0,0 +1,21 @@
+package vfsutil
+
+import (
+ "net/http"
+ "os"
+)
+
+// File implements http.FileSystem using the native file system restricted to a
+// specific file served at root.
+//
+// While the FileSystem.Open method takes '/'-separated paths, a File's string
+// value is a filename on the native file system, not a URL, so it is separated
+// by filepath.Separator, which isn't necessarily '/'.
+type File string
+
+func (f File) Open(name string) (http.File, error) {
+ if name != "/" {
+ return nil, &os.PathError{Op: "open", Path: name, Err: os.ErrNotExist}
+ }
+ return os.Open(string(f))
+}