Commit graph

45 commits

Author SHA1 Message Date
Sönke Ludwig cef4885a63 Update change log. 2020-03-18 15:32:26 +01:00
Sönke Ludwig 8e24c4a204 Correct copyright holder.
rejectedsoftware e.K. doesn't exist anymore since mid-2019.
2020-01-27 19:20:52 +01:00
Sönke Ludwig f56fd7580c Avoid reallocating the data in readFileUTF8 if the UTF encoding is valid.
Uses the immutable overload of sanitizeUTF8 to reuse the original buffer if possible.
2019-10-22 11:41:35 +02:00
Sönke Ludwig d9e545bf60 Fix getFileInfo's exception handling and reduce overhead of the background work.
Instead of asyncWork, now uses a worker task directly and signals the finalization of the result using message passing. This avoids the roundtrip required to return the task handle, as well as the heap allocated result buffer of Future!T.
2019-08-25 12:02:08 +02:00
Sönke Ludwig ce1adf8c3b
Merge pull request #172 from vibe-d/async_file_operations
Avoid all blocking file operations outside of worker threads
2019-08-21 20:59:45 +02:00
Sönke Ludwig e3a38b374e Let all non-aio file system functions run in worker threads.
This avoids stalling the event loop in case of lengthy I/O (network shares, spinning up hard drives etc).
2019-08-21 13:34:00 +02:00
v1ne 513bebcb95 FileStream: Approximate the file offset better when appending
Instead of starting at zero, start at the current file size. This offset
is stored in FileStream. It is only an approximation because concurrent
writes could advance the file without FileStream's knowledge.

Add a test that shows that the offset is approximated as expected and that
appending to an existing file works, too.

This is also a regression test which shows that appending to an existing
file works as expected. See vibe-d/eventcore#115.
2019-07-26 00:38:15 +02:00
v1ne ce9faec1c1 FileStream: Forbid seek(.) or truncate(.) when appending to a file
Those functions do not work for files opened for appending. Make this clear.
2019-07-26 00:29:59 +02:00
v1ne 3ebb065509 Clean up: Use "enforce" 2019-07-26 00:29:59 +02:00
Sönke Ludwig 989577ff23 Fix copyFile setting file times of write protected files. 2019-06-16 15:10:50 +02:00
Sönke Ludwig a86f25b3b4 Fix range violation in makeFileInfo and add some unit tests. 2019-04-05 09:47:32 +02:00
Sönke Ludwig 8e4adf000f Make the DirEntry->FileInfo conversion nothrow.
Avoids listDirectory/iterateDirectory getting interrupted when stumbling over inaccessible files. The `name` field of the returned file info value is always set, so that these files can still be identified.
2019-03-25 09:45:47 +01:00
Francesco Mecca 6292320bb2 support isFile 2019-03-21 17:39:44 +01:00
Sönke Ludwig 2f552ac408 Properly handle directory watcher creation failures. 2019-01-14 14:59:03 +01:00
Sönke Ludwig 9583df3c44 Preserve times and attributes in copyFile. 2019-01-14 14:59:02 +01:00
Sönke Ludwig c899798be7 Avoid blocking copy in moveFile. 2019-01-14 00:34:15 +01:00
Benjamin Schaaf 12a8825f86
Fix error message in FileStream.write 2019-01-07 10:26:16 +11:00
The Dlang Bot e5d53249fc
Merge pull request #113 from vibe-d/file_truncate
Add FileStream.truncate
merged-on-behalf-of: Sönke Ludwig <s-ludwig@users.noreply.github.com>
2018-12-28 14:03:19 +01:00
Sönke Ludwig f35e8f1d69 Add FileStream.truncate. 2018-12-28 10:14:50 +01:00
Hiroki Noda a408aac808 Use monotonic clock for timeout 2018-12-24 06:22:53 +09:00
Sönke Ludwig 2c63aa5c5c Allow destructors to run in foreign threads. Fixes #69.
This change modifies destructors to anticipate that they can be called form a foreign thread if the GC is involved. The actual release of the reference will then happen deferred in the original thread.
2018-03-16 18:06:53 +01:00
Sönke Ludwig dad84e8a46 Adjust DirectoryWatcher implementation for changed FileChange definition in eventcore. 2017-11-21 21:42:44 +01:00
Sönke Ludwig 094de42f97 Update change log. 2017-11-17 11:56:18 +01:00
Sönke Ludwig 2a106ebcbb Add FileInfo.hidden. 2017-11-07 16:14:02 +01:00
Sönke Ludwig 710c996666
Add assertion message. 2017-10-30 22:55:22 +01:00
Sönke Ludwig a6eeae97f3 Fix DirectoryWatcher's creation of its LocalManualEvent. 2017-07-20 16:52:34 +02:00
Sebastian Wilzbach 8f89733a86 Remove all trailing whitespace
sed 's/[ \t]*$//' -i **/*.d
2017-07-03 12:19:27 +02:00
Sönke Ludwig 07e077a009
Redesign the Path type to statically encode the path format.
The previous design, while intended as an improvement over the one-size-fits all Path struct of vibe-d:core, turned out to produce lots of bugs during the transition, because of missing Path.type checks.

The new design uses a cleaner approach, where the static type of a path value encodes the path format. An explicit cast is necessary to convert between different path types. The internet path type also performs proper validation and percent encoding, so that InetPath.toString() always produces a valid URI path.
2017-06-21 14:04:24 +02:00
Sönke Ludwig 6f7c897f91 Fix getFileInfo name return value for paths that end with a slash. 2017-06-12 17:31:52 +02:00
Sönke Ludwig 0aed5664ef
Let openFile throw on failure instead of returning an invalid stream. 2017-05-30 10:57:31 +02:00
Sönke Ludwig 1d9e88f27a Fix createTempFile on Windows. 2017-03-09 16:09:46 +01:00
Sönke Ludwig 68430a1ea4
Fix file pointer management in FileStream. Fixes rejectedsoftware/vibe.d#1684. 2017-02-16 23:37:41 +01:00
Sönke Ludwig e88d2d1b4b
Fix segfault in DirectoryWatcher. 2017-01-29 22:11:17 +01:00
Sönke Ludwig 5f980acefd
Upgrade to latest eventcore. 2017-01-25 21:04:13 +01:00
Sönke Ludwig 2acc60934f
Add IOMode parameters to stream read/write methods. 2017-01-19 00:36:32 +01:00
Sönke Ludwig fdfbb55aa8 Re-implement ManualEvent.
This simplifies the logic by separating thread local notifications from cross-thread notifications, as well as replacing lockless operations by a spin lock. The thread local variant of ManualEvent is now also separated into a LocalManualEvent type.
2017-01-13 22:24:18 +01:00
Sönke Ludwig 35a94412d0 Make FileStream small enough to fit into an InterfaceProxy. 2016-12-26 21:28:36 +01:00
Sönke Ludwig 79656a80df Fix safety error on Windows. 2016-12-19 16:16:50 +01:00
Sönke Ludwig a7bfbc1c45 Implement createTempFile on Posix. 2016-12-10 16:01:40 +01:00
Sönke Ludwig 831ef743f2 Safe-ify the file module. 2016-11-02 20:54:43 +01:00
Sönke Ludwig 0ee42c4243 Add vibe.d 0.7.x compatible stream definitions.
In contrast to 0.7.x, streams can now be either of class, struct or interface type.
2016-10-26 13:11:28 +02:00
Sönke Ludwig 568ccb7127 Implement DirectoryWatcher. 2016-10-25 08:57:16 +02:00
Sönke Ludwig 5bbf07beb8 Fix FileStream.close and let the file test clean up after itself. 2016-10-06 22:15:25 +02:00
Sönke Ludwig cf75d968d5 Base FileStream on eventcore. 2016-10-06 22:06:51 +02:00
Sönke Ludwig 7e2d1dd038 Initial commit.
The library is able to support simple TCP servers in the current state. The API is still mostly compatible with mainline vibe.d, but the driver systen has been replaced by the eventcore library and sockets/files/timers/... are now structs with automatic reference counting instead of GC collected classes. The stream interfaces have been removed for now.
2016-03-01 20:30:42 +01:00