public FsPluginsProvider( string pluginsFolderVirtualPath = FsConstants.DefaultAppPluginsVirtualPath, string shadowCopyDirectoryVirtualPath = FsConstants.DefaultAppPluginsShadowCopyVirtualPath, PluginsRegistrar pluginsRegistrar = null) : base(pluginsRegistrar) { if (string.IsNullOrEmpty(pluginsFolderVirtualPath)) { pluginsFolderVirtualPath = FsConstants.DefaultAppPluginsVirtualPath; } if (string.IsNullOrEmpty(shadowCopyDirectoryVirtualPath)) { shadowCopyDirectoryVirtualPath = FsConstants.DefaultAppPluginsShadowCopyVirtualPath; } if (pluginsRegistrar == null) { pluginsRegistrar = new FsPluginsRegistrar(FsConstants.DefaultAppPluginsRegistrarVirtualPath); } PluginsDirectoryPath = new DirectoryInfo(pluginsFolderVirtualPath.StartsWith("~") ? FsUtils.MapPath(pluginsFolderVirtualPath) : pluginsFolderVirtualPath).FullName; ShadowCopyDirectoryPath = new DirectoryInfo(shadowCopyDirectoryVirtualPath.StartsWith("~") ? FsUtils.MapPath(shadowCopyDirectoryVirtualPath) : shadowCopyDirectoryVirtualPath).FullName; }
public void FsPluginsRegistrar_PathsResolveCorrectly() { var pathTests = new List <string> { "~/plugins/test", "plugins\\test", "plugins//test", Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "plugins\\test") }; var shouldAllResolveToDirectoryPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "plugins\\test"); var shouldAllResolveToFilePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "plugins\\test\\" + FsConstants.PluginsRegistryFileName); foreach (var path in pathTests) { var registrar = new FsPluginsRegistrar(path); // make sure default paths are as expected var directoryPath = registrar.RegistrarDirectory; var registryFilePath = registrar.RegistryFile; Assert.That(directoryPath, Is.SamePath(shouldAllResolveToDirectoryPath)); Assert.That(registryFilePath, Is.SamePath(shouldAllResolveToFilePath)); // directories don't get created until Initialize Assert.That(Directory.Exists(_registrar.RegistrarDirectory), Is.False); Assert.That(File.Exists(_registrar.RegistryFile), Is.False); } }
public void TearDown() { _registrar = null; }
public void SetUp() { _registrar = new FsPluginsRegistrar(); ClearDirectories(); }