Commit Graph

359 Commits

Author SHA1 Message Date
Steve Francia 943d877c43 Fix remaining Windows bugs and tests 2015-12-09 15:37:15 -05:00
Martin Bertschler 9d86e5d5fa Update AppVeyor config to fetch dependencies 2015-12-09 10:05:28 +01:00
Steve Francia daf7a87d8f Make "findParent" work on Windows properly
Fixes #31
2015-12-08 21:48:19 -05:00
Steve Francia e042b5f805 making the fs property accessible Afero.fs -> Afero.Fs 2015-12-08 16:26:39 -05:00
Steve Francia 28bccc4ad0 reorder all utility functions to have fs as 1st param
This is a BREAKING CHANGE to the Walk and ReadDir functions that
existed prior to this branch addition. This change is not done without
considerable thought.

Having FS come first is done for two reasons.
1: It's more idiomatic go
2: It's more logical. It allows the function signature to read easier
and flow from the broadest value to the most narrow.

For example, WriteReader would read..
writeReader on this fs, to this path (on that fs),
with this data (at that path, on that fs).

I believe that when the first two were implemented it wasn't at all
obvious that the order wasn't correct, nevertheless, permitting a
lot of new functions defined in an incorrect or inconsistent order
seems like the worst option.

It was decided that a breaking change today would be best, even if it
was mildly painful at the present.
2015-12-08 16:26:39 -05:00
Steve Francia 90555c1894 reorganize utils into afero package 2015-12-08 16:26:38 -05:00
Steve Francia 3a517135a5 Adding Afero/utils
Portions ported from Go StdLib ioutils
Portions ported from Hugo's helpers
2015-12-08 16:24:09 -05:00
Steve Francia f50d862134 Adding "/" to MemMapFS in a cleaner way 2015-12-08 16:24:09 -05:00
Steve Francia a9385f2db9 Removing extra normalize call
(since open already normalizes)
2015-12-08 16:24:09 -05:00
Steve Francia 54ad8f690d MkdirAll should respect permissions (MemMapFS) 2015-12-08 16:24:09 -05:00
Martin Bertschler adb80c3cf7 Fix AppVeyor badge 2015-12-08 18:08:37 +01:00
Martin Bertschler 708d4bcfd5 Fix walk function in test to not panic if an error is passed 2015-12-06 16:25:06 +01:00
Martin Bertschler 17333d8c34 Integrate AppVeyor config file 2015-12-06 12:29:59 +01:00
Martin Bertschler b705e04d55 Add AppVeyor badge to Readme 2015-12-06 11:56:46 +01:00
Martin Bertschler 55789de153 Format Readme.md code blocks as Go code 2015-12-03 18:23:48 +01:00
Steve Francia 3a224e9827 Normalize Paths so "/boo/" and "/boo" are the same 2015-12-03 09:45:14 -05:00
Steve Francia 75dc847d59 Start MemMapFS with a root directory. 2015-12-02 16:27:14 -05:00
Steve Francia f85f3b3779 reorganize and update readme 2015-12-01 17:10:13 -05:00
Steve Francia 4d968e2d2e Add logo image to readme 2015-11-30 21:04:23 -05:00
Steve Francia 4a72472d2c Update README.md 2015-11-30 20:54:51 -05:00
Martin Bertschler 12fcb8c83d Merge pull request #23 from tpng/patch-1
atomic requires struct field to be 64-bit aligned
2015-11-26 08:07:36 +01:00
Benny Ng 6fafcd5853 atomic requires struct field to be 64-bit aligned
fix https://github.com/spf13/hugo/issues/1621
2015-11-26 13:03:56 +08:00
Martin Bertschler 0ad3406941 Merge pull request #22 from mbertschler/fix-rename
Fix MemMapFs.Rename()
2015-11-22 14:42:06 +01:00
Martin Bertschler 5a59c3f940 properly rename files by changing file.name and newly registering with parent 2015-11-22 14:34:57 +01:00
Martin Bertschler 3fc0d6fb2b make TestRename fail, make tests less verbose when they don't fail
TestRename fails now because MemMapFs.Rename does not change the filename in the parent's memDir
2015-11-22 14:26:00 +01:00
spf13 3f6f746a75 Treat existing files and directories differently in MemMapFS. 2015-11-16 21:26:16 -05:00
Alex Tomlins 19b2cf0372 Fix typo in README
O_TRUNC was listed twice, and O_CREATE omitted from the release notes.
2015-11-07 08:00:20 -05:00
Martin Bertschler 0a58b8245b Fix a bug that happens when the parent is the "." file. 2015-11-07 01:33:53 +01:00
Martin Bertschler 1407a13a63 Update README.md File interface and docs badge
Add a GoDocs badge
Change the badges to .svg
Add Sync() to File interface
2015-11-06 11:43:47 -05:00
Martin Bertschler 33ecf3dc6b Add Sync() to the File interface, implement Sync() for InMemoryFile
Sync() for InMemoryFile always returns nil.
2015-11-06 11:43:47 -05:00
Martin Bertschler aca753daff Update README.md Release Notes and Contributors
Add a new version 0.9.0 to Release Notes to highlight recent improvements in afero
Add mbertschler as contributor.
Rename MemFile to its actual name InMemoryFile.
2015-11-06 11:43:47 -05:00
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