Exclude paths from virtual filesystem

We have a web app that uses node and jspm, and happened to have node_modules “available” on the virtual file system, through a FileSystemVirtualPathProvider.

There was one package with some long paths (node_modules\gulp-rev\node_modules\gulp-util\node_modules\dateformat\node_modules\meow\node_modules\read-pkg-up\node_modules\read-pkg\node_modules\load-json-file\node_modules\pinkie-promise\node_modules) which broke the provider, which in turn broke our app because some views weren’t getting found.

It doesn’t seem to be possible to exclude paths from the provider (or from the scanning) as it is now, except if I subclass the provider and reimplement some of the parts.

Feature request: can we have the ability to exclude paths from a provider? Perhaps add a list of excluded folders for a FileSystemVirtualPathProvider that won’t get scanned/navigated into?

Thanks

The exceptions thrown were:

FileSystemVirtualDirectory WARN Unable to scan for *.cshtml in <snip>\node_modules\gulp-rev\node_modules\gulp-util\node_modules\dateformat\node_modules\meow\node_modules\read-pkg-up\node_modules\read-pkg\node_modules\load-json-file\node_modules\pinkie-promise\node_modules 
System.IO.PathTooLongException: The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.
   at System.IO.Path.NormalizePath(String path, Boolean fullCheck, Int32 maxPathLength, Boolean expandShortPaths)
   at System.IO.Path.GetDirectoryName(String path)
   at System.IO.FileSystemEnumerableIterator`1..ctor(String path, String originalUserPath, String searchPattern, SearchOption searchOption, SearchResultHandler`1 resultHandler, Boolean checkHost)
   at System.IO.DirectoryInfo.InternalGetFiles(String searchPattern, SearchOption searchOption)
   at System.IO.DirectoryInfo.GetFiles(String searchPattern, SearchOption searchOption)
   at ServiceStack.VirtualPath.FileSystemVirtualDirectory.GetMatchingFilesInDir(String globPattern) | <GetAllMatchingFiles>d__0.MoveNext => <GetAllMatchingFiles>d__0.MoveNext => FileSystemVirtualDirectory.GetMatchingFilesInDir

System.IO.PathTooLongException: The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.
   at System.IO.PathHelper.GetFullPathName()
   at System.IO.Path.NormalizePath(String path, Boolean fullCheck, Int32 maxPathLength, Boolean expandShortPaths)
   at System.IO.Path.GetFullPathInternal(String path)
   at System.Security.Util.StringExpressionSet.CanonicalizePath(String path, Boolean needFullPath)
   at System.Security.Util.StringExpressionSet.CreateListFromExpressions(String[] str, Boolean needFullPath)
   at System.Security.Permissions.FileIOPermission.AddPathList(FileIOPermissionAccess access, AccessControlActions control, String[] pathListOrig, Boolean checkForDuplicates, Boolean needFullPath, Boolean copyPathList)
   at System.Security.Permissions.FileIOPermission..ctor(FileIOPermissionAccess access, String path)
   at System.IO.FileSystemInfo.get_FullName()
   at ServiceStack.VirtualPath.FileSystemVirtualDirectory.get_RealPath()
   at ServiceStack.VirtualPath.FileSystemVirtualDirectory.GetMatchingFilesInDir(String globPattern)
   at ServiceStack.VirtualPath.AbstractVirtualDirectoryBase.<GetAllMatchingFiles>d__0.MoveNext()
   at ServiceStack.VirtualPath.AbstractVirtualDirectoryBase.<GetAllMatchingFiles>d__0.MoveNext()
   at ServiceStack.VirtualPath.AbstractVirtualDirectoryBase.<GetAllMatchingFiles>d__0.MoveNext()
   at ServiceStack.VirtualPath.AbstractVirtualDirectoryBase.<GetAllMatchingFiles>d__0.MoveNext()
   at ServiceStack.VirtualPath.AbstractVirtualDirectoryBase.<GetAllMatchingFiles>d__0.MoveNext()
   at ServiceStack.VirtualPath.AbstractVirtualDirectoryBase.<GetAllMatchingFiles>d__0.MoveNext()
   at ServiceStack.VirtualPath.AbstractVirtualDirectoryBase.<GetAllMatchingFiles>d__0.MoveNext()
   at ServiceStack.VirtualPath.AbstractVirtualDirectoryBase.<GetAllMatchingFiles>d__0.MoveNext()
   at ServiceStack.VirtualPath.AbstractVirtualDirectoryBase.<GetAllMatchingFiles>d__0.MoveNext()
   at ServiceStack.VirtualPath.AbstractVirtualDirectoryBase.<GetAllMatchingFiles>d__0.MoveNext()
   at ServiceStack.VirtualPath.AbstractVirtualDirectoryBase.<GetAllMatchingFiles>d__0.MoveNext()
   at ServiceStack.VirtualPath.AbstractVirtualDirectoryBase.<GetAllMatchingFiles>d__0.MoveNext()
   at ServiceStack.VirtualPath.AbstractVirtualDirectoryBase.<GetAllMatchingFiles>d__0.MoveNext()
   at ServiceStack.VirtualPath.AbstractVirtualDirectoryBase.<GetAllMatchingFiles>d__0.MoveNext()
   at ServiceStack.VirtualPath.AbstractVirtualDirectoryBase.<GetAllMatchingFiles>d__0.MoveNext()
   at ServiceStack.VirtualPath.AbstractVirtualDirectoryBase.<GetAllMatchingFiles>d__0.MoveNext()
   at ServiceStack.VirtualPath.AbstractVirtualDirectoryBase.<GetAllMatchingFiles>d__0.MoveNext()
   at ServiceStack.VirtualPath.AbstractVirtualDirectoryBase.<GetAllMatchingFiles>d__0.MoveNext()
   at ServiceStack.VirtualPath.AbstractVirtualDirectoryBase.<GetAllMatchingFiles>d__0.MoveNext()
   at ServiceStack.VirtualPath.AbstractVirtualDirectoryBase.<GetAllMatchingFiles>d__0.MoveNext()
   at System.Linq.Enumerable.<SelectManyIterator>d__1`2.MoveNext()
   at System.Linq.Enumerable.<DistinctIterator>d__1`1.MoveNext()
   at ServiceStack.EnumerableExtensions.Each[T](IEnumerable`1 values, Action`1 action)
   at ServiceStack.Razor.Managers.RazorViewManager.ScanPaths()
   at ServiceStack.Razor.Managers.RazorViewManager.Init()
   at ServiceStack.Razor.RazorFormat.Init()
   at ServiceStack.Razor.RazorFormat.Register(IAppHost appHost) | AppHostExtensions.NotifyStartupException => ServiceStackHost.OnStartupException => DtoUtils.CreateErrorResponse

Interesting what version are you using? We added node_modules to Config.ScanSkipPaths a while ago.

Ah, sorry, I missed that config param.

Our node_modules is under /app/, so we needed to add to the default ScanSkipPaths.

Many thanks!