Пример #1
0
        private void CreateDirectoryWithLongPath(string root, IMutableFileSystem fileSystem)
        {
            const int MaxPath = 260;

            // Create root/0001/.../00XX.
            int    i       = 0;
            string current = root;

            while (true)
            {
                current = Path.Combine(current, i.ToString("D4"));
                var path = AbsolutePath.Create(fileSystem.GetPathTable(), current);
                fileSystem.CreateDirectory(path);

                if (current.Length > MaxPath)
                {
                    return;
                }
            }
        }
Пример #2
0
        /// <nodoc />
        public static DsTestWriter Create(string sourceRoot, IEnumerable <BuildSpec> buildSpecs, IMutableFileSystem fileSystem)
        {
            // Putting source into the nested folder in order to avoid file access violation when writing package files outside the source cone.
            var testWriter = new DsTestWriter(fileSystem.GetPathTable(), fileSystem, sourceRoot);

            foreach (var spec in buildSpecs)
            {
                if (spec.FileName == Names.ConfigDsc)
                {
                    testWriter.ConfigWriter.SetConfigContent(spec.Content);
                    testWriter.ConfigWriter.UseLegacyConfigExtension();
                }
                else if (spec.FileName == Names.ConfigBc)
                {
                    testWriter.ConfigWriter.SetConfigContent(spec.Content);
                }
                else
                {
                    testWriter.ConfigWriter.AddBuildSpec(spec.FileName, spec.Content);
                }
            }

            return(testWriter);
        }