Exemplo n.º 1
0
        public void CanExpandPathsInConfigurationInstances()
        {
            var ironpythonConfiguration = new Plugins.IronPython.Configuration()
            {
                ScriptDirectories = new List <string>()
                {
                    @"$plugins$\Ironpython", @"$user_data$\Ironpython"
                }
            };

            var coreConfiguration = new CoreConfiguration("c:\\data", "c:\\plugins");
            var expanded          = coreConfiguration.ExpandPaths(ironpythonConfiguration.ScriptDirectories).ToList();

            Assert.Contains(@"c:\data\Ironpython", expanded);
            Assert.Contains(@"c:\plugins\Ironpython", expanded);
        }
        private IEnumerable <DirectoryInfo> GetIronPythonPluginsDirectories()
        {
            IEnumerable <DirectoryInfo> directoryInfos = CoreConfiguration
                                                         .ExpandPaths(Configuration.ScriptDirectories)
                                                         .Select(p => Path.GetFullPath(p))
                                                         .Distinct()
                                                         .Select(p => new DirectoryInfo(p));

            foreach (var directory in directoryInfos)
            {
                if (!directory.Exists)
                {
                    _log.Warn("Directory {0} doesn't exist", directory.FullName);
                    continue;
                }
                yield return(directory);
            }
        }