< Summary

Class:DCL.SystemWrappers
Assembly:ABConverter
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/ABConverter/Wrappers/Implementations/Default/Directory.cs
/tmp/workspace/unity-renderer/unity-renderer/Assets/ABConverter/Wrappers/Implementations/Default/File.cs
Covered lines:0
Uncovered lines:32
Coverable lines:32
Total lines:85
Line coverage:0% (0 of 32)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
CreateDirectory(...)0%2100%
InitializeDirectory(...)0%20400%
Delete(...)0%6200%
Exists(...)0%2100%
Delete(...)0%2100%
Exists(...)0%2100%
Copy(...)0%2100%
Move(...)0%2100%
ReadAllText(...)0%2100%
WriteAllText(...)0%2100%
WriteAllBytes(...)0%2100%
OpenRead(...)0%2100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/ABConverter/Wrappers/Implementations/Default/Directory.cs

#LineLine coverage
 1using System;
 2using UnityEngine;
 3
 4namespace DCL
 5{
 6    public static partial class SystemWrappers
 7    {
 8        public class Directory : IDirectory
 9        {
 010            public void CreateDirectory(string path) { System.IO.Directory.CreateDirectory(path); }
 11
 12            public void InitializeDirectory(string path, bool deleteIfExists)
 13            {
 14                try
 15                {
 016                    if (deleteIfExists)
 17                    {
 018                        if (Exists(path))
 019                            Delete(path, true);
 20                    }
 21
 022                    if (!Exists(path))
 023                        CreateDirectory(path);
 024                }
 025                catch (Exception e)
 26                {
 027                    Debug.LogError($"Exception trying to clean up folder. Continuing anyways.\n{e.Message}");
 028                }
 029            }
 30
 31            public void Delete(string path, bool recursive)
 32            {
 33                try
 34                {
 035                    if (Exists(path))
 036                        System.IO.Directory.Delete(path, recursive);
 037                }
 038                catch (Exception e)
 39                {
 040                    Debug.LogError($"Error trying to delete directory {path}!\n{e.Message}");
 041                }
 042            }
 43
 044            public bool Exists(string path) { return System.IO.Directory.Exists(path); }
 45        }
 46    }
 47}

/tmp/workspace/unity-renderer/unity-renderer/Assets/ABConverter/Wrappers/Implementations/Default/File.cs

#LineLine coverage
 1using System;
 2using System.IO;
 3using UnityEngine;
 4
 5namespace DCL
 6{
 7    public static partial class SystemWrappers
 8    {
 9        public class File : IFile
 10        {
 11            public void Delete(string path)
 12            {
 13                try
 14                {
 015                    System.IO.File.Delete(path);
 016                }
 017                catch (Exception e)
 18                {
 019                    Debug.LogError($"Error trying to delete file {path}!\n{e.Message}");
 020                }
 021            }
 22
 023            public bool Exists(string path) { return System.IO.File.Exists(path); }
 24
 025            public void Copy(string srcPath, string dstPath) { System.IO.File.Copy(srcPath, dstPath); }
 26
 027            public void Move(string srcPath, string dstPath) { System.IO.File.Move(srcPath, dstPath); }
 28
 029            public string ReadAllText(string path) { return System.IO.File.ReadAllText(path); }
 30
 031            public void WriteAllText(string path, string text) { System.IO.File.WriteAllText(path, text); }
 32
 033            public void WriteAllBytes(string path, byte[] bytes) { System.IO.File.WriteAllBytes(path, bytes); }
 34
 035            public Stream OpenRead(string path) { return System.IO.File.OpenRead(path); }
 36        }
 37    }
 38}