Commit Graph

128 Commits

Author SHA1 Message Date
Martin Bertschler 56c149609a add Walk function similar to filepath.Walk, add test for Walk 2015-11-06 11:43:46 -05:00
Alex Tomlins 582dcbe54c Support O_TRUNC flag to MemMapFs.OpenFile
To truncate an existing file when opening.
2015-11-05 06:59:56 -05:00
Alex Tomlins 7441922445 Support O_APPEND flag in *MemMapFs.Openfile
To allow opening an existing file in append mode.
2015-11-05 06:59:56 -05:00
Alex Tomlins 47e9336de6 Handle O_CREATE flag to *MemMapFs.OpenFile.
To allow MemMapFs to be used in place of OsFs in tests where this flag
is used to create the file if it doesn't already exist..
2015-11-05 06:59:56 -05:00
Bjørn Erik Pedersen 42d35dace7 Merge pull request #16 from mbertschler/master
fix Readdir() and Readdirnames()
2015-11-05 10:21:28 +01:00
Martin Bertschler 171091926d change Readdir test to work, update Fs and File interface in README
Readdir test worked on OS X but not on CI, because the assumption that the os.File Readdir returns files sorted by name is not true on all operating systems
2015-11-04 23:43:06 +01:00
Martin Bertschler 10150bfa64 fix Readdir behaviour for n > 0, fix RemoveAll 2015-11-04 20:33:40 +01:00
Martin Bertschler c64453ab4d fix InMemoryFileInfo.Name() and File.Readdirnames() to only return the file name and not the full path to make it conform with the behaviour of the os package 2015-10-17 13:02:31 +02:00
Martin Bertschler fbb31b7318 add tests for Readdir, Readdirnames and add check in TestRemove to see if file was removed from the parent file list 2015-10-17 13:00:33 +02:00
Martin Bertschler 3de0cfae06 make Readdir and Readdirnames work
+ fix registerWithParent function
+ fix unRegisterWithParent and use it in Remove and RemoveAll
+ fix findParent function
+ add lock free versions of Mkdir and Open for the use during register and unregistering with parent, so that these changes happen atomical
2015-10-17 12:58:11 +02:00
Alex Tomlins 6ced24dbe1 Make MemMapFs.Remove() error for non-existent file
So that it's consistent with the os package.
2015-09-08 08:16:57 -04:00
Alex Tomlins a269144fd6 Fix MemMapFs.Remove() to really delete the file.
It was attempting to delete a file with a hardcoded path of "name" as
opposed to the path in the `name` variable.

Fixing this exposed a deadlock because the function was attempting to
acquire an exclusive lock when it already had a read lock.
2015-09-08 08:16:57 -04:00
Anton Tiurin 5849bf9936 [MemMap] Fix a data race
Signed-off-by: Anton Tiurin <noxiouz@yandex.ru>
2015-09-08 08:15:56 -04:00
spf13 0efc34d380 Merge branch 'master' of github.com:spf13/afero 2015-05-25 21:11:05 -04:00
Jamie Wilkinson e54aac2c6a Apply locking in InMemoryFile 2015-05-04 23:55:26 +02:00
Jamie Wilkinson af8b55cd1f Add jaqx0r to the list of contributors. 2015-05-01 17:53:54 -04:00
Jamie Wilkinson 925f67ead8 Fix extra whitespace. 2015-05-01 17:53:54 -04:00
Jamie Wilkinson d82243906a Test that a read of nonzero bytes from an InMemFile does not return EOF in the same read op. 2015-05-01 17:53:54 -04:00
Jamie Wilkinson 56a1f83590 Add a test for the EOF behaviour of Read. 2015-05-01 17:53:54 -04:00
Wayne E. Seguin 139e50e29a 'fs' => 'afero'
Changed remaining 'fs' to 'afero' in README.
2015-02-24 11:57:06 -05:00
Anthony Fok 3effba0913 Correct directory permission of testDir
When fs.MkdirAll() was called with a permission of "777" (without the 0 prefix),
it generated the testDir with a permission of `dr----x--x`, causing the following error
during a test run:

    === RUN TestRead0
    --- FAIL: TestRead0 (0.00 seconds)
    	fs_test.go:53: OsFs create failed: open /tmp/fun/test.txt: permission denied

Changing the decimal `777` to octal `0777` fixes the problem.
2014-12-12 13:33:27 -05:00
spf13 f20e72f15f adding List function to memmapfs 2014-12-12 13:32:57 -05:00
spf13 11dade3cc0 Adding Travis-CI support 2014-11-01 00:25:15 -04:00
spf13 263a98f9ad MemDir now reports a size 2014-10-31 23:39:14 -04:00
spf13 f5d2472495 Adding proper open support for memfile 2014-10-31 23:38:54 -04:00
spf13 0c3b992fe6 Adding chmod and chtimes support. 2014-10-31 23:36:45 -04:00
spf13 0bc61700a3 afero is born 2014-10-28 10:29:28 -04:00
Steve Francia a454cef144 Initial commit 2014-10-28 10:19:05 -04:00