Commit graph

657 commits

Author SHA1 Message Date
Elias Batek
89f5914683
Revert "Fix #9584 - Using dirEntries and chdir() can have unwanted results (#10666)" (#10718)
This essentially reverts commit 274109b3de.
2025-03-27 16:21:21 +08:00
Elias Batek
12f99e5fff
Remove empty line between doc comment and unittest (#10705) 2025-03-23 16:23:10 +08:00
Elias Batek
264618e838
Cleanup DirIteratorImpl.__ctor (#10668) 2025-03-15 08:41:33 +08:00
Elias Batek
1e70ab9301
Remove range support from DirIteratorImpl.__ctor (#10667)
Was unused, untested and potentially broken.
2025-03-13 15:56:08 +08:00
Elias Batek
274109b3de
Fix #9584 - Using dirEntries and chdir() can have unwanted results (#10666)
Co-authored-by: GallaFrancesco <francesco.galla3@gmail.com>
Co-authored-by: Elias Batek <15967408+0xEAB@users.noreply.github.com>
2025-03-12 16:14:48 +08:00
Vladiwostok
231ae8b68a
Fix D-Scanner linting issues (#9070)
* Fix UndocumentedDeclarationCheck linting issue

* Fix IfConstraintsIndentCheck linting issue

* Address feedback

* Fix publictests CI

* Fix old (libdparse) D-Scanner linting warn
2024-10-27 01:21:56 -07:00
Nick Treleaven
38fa9c3294 Fix Bugzilla 24564 - std.file.DirEntry throws Exception instead of FileException 2024-05-25 00:50:58 +02:00
Horodniceanu Andrei
b2853536e9
std/file.d: Don't check for OS-dependent error message in unittest
Signed-off-by: Horodniceanu Andrei <a.horodniceanu@proton.me>
2024-03-22 09:18:42 +02:00
Per Nordlöw
8d03d52db4 Add doc hints between read and readText 2023-03-15 12:52:00 +01:00
Vladimir Panteleev
42aa5809a5
Fix Issue 23683 - std.file.setTimes requests more permissions than needed 2023-02-13 18:09:49 +00:00
Nick Treleaven
52dfd3e553 Remove RUNNABLE_EXAMPLE to fix DAutoTest 2023-01-04 19:43:38 +00:00
Nick Treleaven
ac5108e7e0 Apply suggestions from code review
Co-authored-by: Razvan Nitu <razvan.nitu1305@gmail.com>
2023-01-04 11:38:52 +00:00
Nick Treleaven
4eaa3c49e8 Try using UL macro instead 2023-01-04 11:38:52 +00:00
Nick Treleaven
3aa94941b3 Document dirEntries throws without read permission
Part of:
Issue 12391 - dirEntries throws in foreach

Add example showing how to handle subdirectory read permission failures.
2023-01-04 11:38:52 +00:00
Lucian Danescu
c81788f512 style fix 2022-11-12 19:40:28 +02:00
Lucian Danescu
322fed7bf7 add local imports 2022-11-12 19:29:28 +02:00
Paul Backus
aaa0b705ec
Merge pull request #8368 from dukc/safe-ref-counted
Safe ref counted
2022-10-03 15:05:52 -04:00
Ate Eskola
c8ddafd99d Came up with alternative way to avoid linking errors with DirIterator. 2022-09-22 00:30:20 +03:00
Iain Buclaw
352258539c Fix 'the the' typos in Phobos documentation 2022-09-20 21:31:46 +02:00
Ate Eskola
490caa7090 RefCounted -> SafeRefCounted, OldRefCounted -> RefCounted. 2022-09-11 01:35:35 +03:00
Ate Eskola
bb145a09a6 Ate's work on safe ref counted 2022-09-11 01:35:35 +03:00
Geod24
05cf9c260b std.file: Remove 'in' on OSX setattrlist declaration
Because 'in' are forbidden on extern C function with preview=in.
2022-07-21 00:55:52 +02:00
WebFreak001
73589e6f81
fix Issue 23215: segfault in std.file.remove 2022-06-28 13:15:30 +02:00
Dennis Korpel
e34f88f64d Add missing return scope to std.file 2022-06-22 02:27:36 +00:00
Dennis Korpel
f54e0cd163 Issue 23190 - make some std.file unittests @safe 2022-06-16 11:39:29 +00:00
MoonlightSentinel
362e81830c
Fix 13541 - Replace usages of sysErrorString` with a helper function
`sysErrorString` throws an exception for unknown error codes (e.g. from
libraries using `SetLastError`) and hence could hide the actual error
that caused the call to `sysErrorString`.

The new helper function wraps the error code lookup and returns `Error X`
on failure.
2022-03-28 01:01:25 +02:00
MoonlightSentinel
304160f5af
Issue 13541 - Use wenforce instead of enforce + sysErrorString
This ensures that the actual error message won't be suppressed when the
lookup error code => message fails. The exception will also be more
informative because `WindowsException` is explicitly intended for
Windows API errors.
2022-03-28 01:01:19 +02:00
Iain Buclaw
2b5ab004b2 Add preliminary support for GNU/Hurd 2022-03-22 14:11:33 +00:00
Luís Ferreira
5bc8b25944 std/file: use size_t instead of ulong for ReadFile on Windows
Since ReadFile requires an offset buffer and the maximum size is size_t.max, we
should offset with size_t to avoid overflow on dereferencing.

Signed-off-by: Luís Ferreira <contact@lsferreira.net>
2022-02-27 23:40:34 +00:00
dkorpel
b3b0e74152 Unblock "address of ref can be assigned to non-scope parameter" 2022-02-17 00:44:02 +00:00
Richard Andrew Cattermole
86c7d2ebeb
s/least/lest/
Co-authored-by: Vladimir Panteleev <CyberShadow@users.noreply.github.com>
2022-02-06 04:40:58 +13:00
rikki cattermole
0cdb54d03c s/seperator/separator/ 2022-02-06 04:39:07 +13:00
rikki cattermole
2ca70756c7 Missed some more whitespace. 2022-02-06 04:37:51 +13:00
rikki cattermole
c9cc092cb7 Remove trailing whitespace that was accidently added to std.file tempDir. 2022-02-06 04:30:51 +13:00
rikki cattermole
33e95aea02 Fix Issue 22738 - std.file.tempDir adds an addition / even when it already has one 2022-02-06 04:17:40 +13:00
Atila Neves
8a2bd81b39
Move checkedint out of experimental (#8100)
Move checkedint out of experimental

Signed-off-by: Razvan Nitu <RazvanN7@users.noreply.github.com>
Merged-on-behalf-of: Razvan Nitu <RazvanN7@users.noreply.github.com>
2022-01-25 00:17:24 +00:00
WebFreak001
dac59a4bde add isSomeFiniteCharInputRange as simplification
combines the very common constraint
`isInputRange!R && !isInfinite!R && isSomeChar!(ElementEncodingType!R)`
and adds a bunch of documentation with examples for users to understand
it better. This should lower the neccessary needed technical insight to
read basic docs, especially std.path and std.file docs.
2022-01-15 18:38:52 +01:00
dkorpel
5d0cfcd13a Fix scope usage of SysTime/TimeZone 2021-11-18 23:49:51 +00:00
dkorpel
cd7389266e Add explicit return to inout functions 2021-11-16 23:22:33 +00:00
Nathan Sashihara
2ba87d2ff7 Delete the bodies of a number of private wrapper functions in std.stdio and std.file 2021-10-28 06:10:01 -04:00
RazvanN7
85f426020a Move import of dirSeparator to larger scope 2021-10-22 14:52:57 +03:00
Ryan Frame
02f4f148cf Fix Issue 17488 - Add trailing slash to POSIX tempDir() to match Windows behaviour 2021-10-22 14:52:57 +03:00
Luís Ferreira
c047b238e3
std.file: don't initialize stat_t struct when running stat
Signed-off-by: Luís Ferreira <contact@lsferreira.net>
2021-09-04 20:05:44 +01:00
vladchicos
95329239c9 Windows readImpl is now marked @trusted 2021-08-02 17:55:56 +03:00
vladchicos
f3be11dc29 Fix Issue 16218 - Windows std.file.readImpl should be marked @system. 2021-08-01 14:59:39 +03:00
aG0aep6G
26bb8fcae4
add cast(void) to silence warnings in tests (#8169) 2021-07-20 08:19:00 +08:00
Luís Ferreira
808dca99af file: document dirEntries as no garantee of sorted output
Some unittests should compare with a sorted array to be
correct.

Signed-off-by: Luís Ferreira <contact@lsferreira.net>
2021-06-20 10:52:39 +00:00
nordlow
61d60d2121 Annotate std/file.d to please dlang/dmd#12520 2021-05-20 13:14:21 +02:00
Atila Neves
771e5460b7 Make rmdir unittest @safe 2021-05-10 16:36:18 +02:00
Atila Neves
834ecfb609 Make mkdirRecurse unittest @safe 2021-05-10 16:35:37 +02:00