Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split file tree logs #170

Merged
merged 3 commits into from
Aug 7, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion QModManager/Patching/Patcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ internal static void Patch()

try
{
Logger.Info($"Folder structure:{IOUtilities.GetFolderStructureAsTree()}");
Logger.Info($"Folder structure:");
PrimeSonic marked this conversation as resolved.
Show resolved Hide resolved
IOUtilities.LogFolderStructureAsTree();
}
catch (Exception e)
{
Expand Down
13 changes: 9 additions & 4 deletions QModManager/Utility/IOUtilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,31 +22,36 @@ internal static class IOUtilities
"steam_shader_cache",
};

internal static string GetFolderStructureAsTree(string directory = null)
internal static void LogFolderStructureAsTree(string directory = null)
{
try
{
directory ??= Environment.CurrentDirectory;

return GenerateFolderStructure(directory);
GenerateFolderStructure(directory);
}
catch (Exception e)
{
throw e;
}
}

internal static string GenerateFolderStructure(string directory)
internal static void GenerateFolderStructure(string directory)
{
var builder = new StringBuilder();

try
{
builder.AppendLine();
builder.AppendLine($"+ {new DirectoryInfo(directory).Name}");

Logger.Info(builder.ToString());
builder.Clear();
PrimeSonic marked this conversation as resolved.
Show resolved Hide resolved
foreach (string dir in Directory.GetDirectories(directory))
{
GetFolderStructureRecursively(builder, dir, 0);
Logger.Info(builder.ToString());
PrimeSonic marked this conversation as resolved.
Show resolved Hide resolved
builder.Clear();
}

string[] files = Directory.GetFiles(directory);
Expand All @@ -60,7 +65,7 @@ internal static string GenerateFolderStructure(string directory)
}

builder.AppendLine();
return builder.ToString();
Logger.Info(builder.ToString());
}
catch (Exception e)
{
Expand Down