Commit Graph

240 Commits

Author SHA1 Message Date
Francois Hill (dell laptop) 139c7715f0 Closes spf13/afero#79
Rather keep the `RealPath` behaviour as originally implemented. Added a new method `fullPath` which is used by all other methods like `MkDir`.
2016-04-18 20:14:10 +02:00
Francois Hill (dell laptop) 9a1fcfb267 Closes spf13/afero#79
Added fix to support "nested" `BasePathFs`. Unit-tests are also included.
2016-04-18 19:29:19 +02:00
Bjørn Erik Pedersen 2f194a29d5 Add FileContainsAnyBytes 2016-02-17 11:33:17 +01:00
Bjørn Erik Pedersen 469e5f14dc Add tests for readerContains 2016-02-17 11:05:13 +01:00
bep ddb4d0857d Improve absolute file paths handling in BasePathFs
A common mistake in using the BasePathFs is to give it a real
OS absolute file path instead of a virtual one relative to the virtual base.

This commit adds some tests and returns an error on Windows in this case.

On Unix we have to train the users to do a better job.

See https://github.com/spf13/hugo/issues/1800
2016-02-15 19:09:17 +01:00
bep 3c51231761 Fix broken Windows tests
@spf13 having a CI on Windows is only useful if you actually look at the
build output.
2016-02-15 12:13:46 +01:00
Bjørn Erik Pedersen 28789ef4b7 Add missing copyright to util.go
Using "The Hugo Authors" inside Hugo is fine, since the Git history shows the origin of the code.

By moving the code from Hugo to Afero (deleting the original), that history is lost -- or very hard to track.
2016-02-13 18:09:23 +01:00
Lenilson J. Dias 7e073c0c70 Fix syscall.EBADFD at FreeBSD
Solve this: https://github.com/spf13/afero/issues/68

      go get github.com/spf13/afero
      # github.com/spf13/afero
      gocode/src/github.com/spf13/afero/const_win_unix.go:22: undefined: syscall.EBADFD
2016-02-03 11:50:36 -02:00
Hanno Hecker 4c1d2aade6 Merge pull request #67 from tatsushid/fix/copyonwritefs-patherr-handling
Fix CopyOnWriteFs Stat to handle *os.PathError
2016-02-01 18:04:30 +01:00
Tatsushi Demachi 3bf3fe3a71 Fix CopyOnWriteFs Stat to handle *os.PathError
CopyOnWriteFs Stat function only checks its base file system's file or
directory when its layer file system returns Stat error but if the layer
file system type is OsFs, it returns *os.PathError not syscall.ENOENT so
in this case, the base file system's file or directory is never checked.

This fixes the behavior above by expanding *os.PathError and repacking
the error code if the error type is *os.PathError.
2016-01-31 23:16:38 +09:00
Martin Bertschler 27290598eb rename const file on bsd descendants to make go ignore its extension 2016-01-31 09:25:25 +01:00
Martin Bertschler 95ab1d42de Merge pull request #65 from pjanouch/master
Fix OpenBSD build
2016-01-30 21:43:17 +01:00
premysl 91d2be079c Fix OpenBSD build 2016-01-30 18:29:33 +01:00
Hanno Hecker a5d3e7c8ca fix for OsFs w/ lower timestamp resolution 2016-01-25 14:07:15 -05:00
Hanno Hecker 1f64d06ebe fix isBaseFile 2016-01-25 14:05:49 -05:00
Hanno Hecker d660f82c74 remove MemMepFs limitation 2016-01-25 14:05:49 -05:00
Steve Francia 9383100264 rewrite logic of CoW.Open() with commentary 2016-01-25 14:02:30 -05:00
Steve Francia 2ec8b79d61 Make OsFs.Open interoperable with others (with tests confirming) 2016-01-13 16:37:11 -05:00
Steve Francia 969a70f798 test CopyOnWriteFs with OsFs 2016-01-13 12:41:35 -05:00
Steve Francia 220647edb9 Permit accessing basePath root in BasePathFs (with test) 2016-01-12 00:34:15 -05:00
Steve Francia 52ef806ebb update examples to use 'afero.' before calls 2016-01-11 21:49:09 -05:00
Steve Francia cb3771c13a remove filter 2016-01-11 21:44:13 -05:00
Steve Francia 5c392cd048 Update filenames to reflect new names 2016-01-11 21:44:01 -05:00
Steve Francia fe8e895336 Migrate all backends & readme to use constructorish New... 2016-01-11 21:41:03 -05:00
Steve Francia 4f6cfb713a Update readme to reflect migration of filters to filesystems 2016-01-11 20:48:25 -05:00
Steve Francia 98c426b27b Rename CopyOnWriteUnionFs -> CopyOnWriteFs 2016-01-11 20:48:25 -05:00
Steve Francia 9d548259fd Rename CacheUnionFs -> CacheOnReadFs 2016-01-11 20:48:25 -05:00
Steve Francia a3ed628486 refine BasePathFs implementation 2016-01-11 20:48:25 -05:00
Steve Francia 76b64e1d85 rename HttpFs:SourceFs to 'source' to keep consistent 2016-01-11 20:48:25 -05:00
Steve Francia c6185187f1 port unionFs from filters to filesystems 2016-01-11 20:48:25 -05:00
Steve Francia 84018f2b47 port RO & Regexp from filter to filesystem 2016-01-11 20:48:25 -05:00
Steve Francia da00b1fb7c port BasePathFs from filter to filesystem 2016-01-11 20:48:25 -05:00
Steve Francia 27539916a7 Disable sftp_test.go until it can pass tests 2016-01-11 20:48:25 -05:00
Steve Francia a679d4a95e Add BADFD constant to permit compilation on darwin 2016-01-11 14:42:14 -05:00
Hanno Hecker e68b257a2b add union fs 2016-01-11 14:42:14 -05:00
Steve Francia 300870a2d5 pausing during modtime test so darwin passes 2016-01-11 13:42:25 -05:00
Hanno Hecker 205066d391 Add BasePathFs as FilterFs
* add a BasePathFs implemented as FilterFs:
  The BasePathFs restricts all operations to a given path within an Fs.
  The given file name to the operations on this Fs will be prepended
  with the base path before calling the base Fs.
  Any file name (after filepath.Clean()) outside this base path will be
  treated as non existing file.

* fix meaning of "facere" - "facio" means "I do", "facere" is the base
  form
2016-01-11 13:21:51 -05:00
Martin Bertschler 49e01f227a Merge pull request #57 from spf13/short-test-sleep
Speed up test on unix systems
2016-01-07 12:05:43 +01:00
Martin Bertschler c2313a7dbd Merge pull request #48 from xor-gate/sftp-beta-for-upstream
Add SftpFs experimental backend
2016-01-07 12:05:15 +01:00
Martin Bertschler a19c2e3d70 make test output verbose on travis 2016-01-07 11:58:02 +01:00
Martin Bertschler 9d27152292 try to speed up test on unix systems 2016-01-07 11:52:33 +01:00
Martin Bertschler 6a67f8a50b Remove FileExists error in MemMapFs.Rename when destination file exists, because os.Rename also doesn't return the error 2016-01-07 11:47:44 +01:00
Martin Bertschler d8bbf358ca Merge pull request #56 from vetinari/close-modtime
Set modtime on any write
2016-01-04 19:51:02 +01:00
Hanno Hecker bb3fe39966 set modtime on any write 2016-01-04 19:34:24 +01:00
Martin Bertschler f0b9fc1bdb Implement and test read only MemMapFs file handles
Fixes #53
2016-01-04 01:54:48 +01:00
Martin Bertschler 023640316a Merge pull request #55 from spf13/multiple-mem-file-handles
Seperate MemMapFs file data and file handles
2016-01-04 00:59:32 +01:00
Martin Bertschler a5f01f1106 replace mem.File handles with mem.FileData when mem.FileData is all we need 2016-01-04 00:36:01 +01:00
Martin Bertschler 0321b04b21 fix mem.DirMap and mem.Dir to only use *FileData and not *File handles 2016-01-04 00:18:26 +01:00
Martin Bertschler 7096d68458 mem.File is now mem.FileData and mem.File is a file handle with a pointer to a mem.FileData 2016-01-03 23:59:42 +01:00
Martin Bertschler 7b991cb257 add a test that fails if MemMapFs has the same `at` counter for multiple file objects 2016-01-03 22:11:08 +01:00