diff --git a/dscanner b/dscanner index 552d0bb..42762f8 160000 --- a/dscanner +++ b/dscanner @@ -1 +1 @@ -Subproject commit 552d0bbb074445979675ab9784baf8119c6e1f3e +Subproject commit 42762f8dcd2ca542d07e3fd5bc3ae0586fc7ea68 diff --git a/modulecache.d b/modulecache.d index fded2da..7b957d2 100644 --- a/modulecache.d +++ b/modulecache.d @@ -46,6 +46,14 @@ struct CacheEntry } } +bool existanceCheck(A)(A path) +{ + if (path.exists()) + return true; + Log.error("Cannot cache modules in ", path, " because it does not exist"); + return false; +} + /** * Caches pre-parsed module information. */ @@ -66,16 +74,9 @@ struct ModuleCache */ static void addImportPaths(string[] paths) { - foreach (path; paths) - { - if (!exists(path)) - { - Log.error("Cannot cache modules in ", path, " because it does not exist"); - continue; - } - importPaths ~= path; - } - foreach (path; paths) + string[] addedPaths = paths.filter!(a => existanceCheck(a)).array(); + importPaths ~= addedPaths; + foreach (path; addedPaths) { foreach (fileName; dirEntries(path, "*.{d,di}", SpanMode.depth)) { diff --git a/server.d b/server.d index 85d0833..d1c8836 100644 --- a/server.d +++ b/server.d @@ -218,7 +218,7 @@ string[] loadConfiguredImportDirs() return []; Log.info("Loading configuration from ", configLocation); File f = File(configLocation, "rt"); - return f.byLine(KeepTerminator.no).map!(a => a.idup).filter!(a => a.exists()).array(); + return f.byLine(KeepTerminator.no).map!(a => a.idup).filter!(a => existanceCheck(a)).array(); } void printHelp(string programName)