From 1e70ab93017fcee47922b3275498ad34fe8c1a86 Mon Sep 17 00:00:00 2001 From: Elias Batek Date: Thu, 13 Mar 2025 08:56:08 +0100 Subject: [PATCH] Remove range support from `DirIteratorImpl.__ctor` (#10667) Was unused, untested and potentially broken. --- std/file.d | 30 ++++++++---------------------- 1 file changed, 8 insertions(+), 22 deletions(-) diff --git a/std/file.d b/std/file.d index c30e3a061..42c3d8262 100644 --- a/std/file.d +++ b/std/file.d @@ -4797,34 +4797,20 @@ private struct DirIteratorImpl } } - this(R)(R pathname, SpanMode mode, bool followSymlink) - if (isSomeFiniteCharInputRange!R) + this(string pathname, SpanMode mode, bool followSymlink) { + import std.path : absolutePath, isAbsolute; + _mode = mode; _followSymlink = followSymlink; - static if (isNarrowString!R && is(immutable ElementEncodingType!R == immutable char)) - { - import std.path : absolutePath, isAbsolute; - string pathnameStr; - if (pathname.isAbsolute) - pathnameStr = pathname; - else - { - pathnameStr = pathname.absolutePath; - const offset = (pathnameStr.length - pathname.length); - _pathPrefix = pathnameStr[0 .. offset]; - } - } + string pathnameStr; + if (pathname.isAbsolute) + pathnameStr = pathname; else { - import std.algorithm.searching : count; - import std.array : array; - import std.path : asAbsolutePath; - import std.utf : byChar; - string pathnameStr = pathname.asAbsolutePath.array; - const pathnameCount = pathname.byChar.count; - const offset = (pathnameStr.length - pathnameCount); + pathnameStr = pathname.absolutePath; + const offset = (pathnameStr.length - pathname.length); _pathPrefix = pathnameStr[0 .. offset]; }