Skip to content

Commit

Permalink
fix working directory logic
Browse files Browse the repository at this point in the history
  • Loading branch information
Happyrobot33 committed May 30, 2024
1 parent a83cd29 commit 7de423c
Show file tree
Hide file tree
Showing 10 changed files with 21 additions and 22 deletions.
37 changes: 18 additions & 19 deletions CodeCoverage/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@ public partial class Program
const string blue = "\x1b[34m";
const string reset = "\x1b[39m";

static string basePath = @"E:\Storage\Personal\Coding\VRChat\VRCSDK-Documentation-Project";
//static string basePath = @"E:\Storage\Personal\Coding\VRChat\VRCSDK-Documentation-Project";
static List<string> assemblys = new List<string>();
//static string testAssemblyPath = basePath + @"\Packages\com.vrchat.base\Runtime\VRCSDK\Plugins\VRCSDKBase.dll";
//static string testAssemblyPath = workingDirectory + @"\Packages\com.vrchat.base\Runtime\VRCSDK\Plugins\VRCSDKBase.dll";
static string workingDirectory = Environment.CurrentDirectory;

static string XMLPath = @"\Packages\com.happyrobot33.vrcsdkdocumentation\Editor\Documentation";

Expand All @@ -43,17 +44,15 @@ public static void Main(string[] args)
//clear the terminal
Console.Clear();

//try to make a basepath
string workingDirectory = Environment.CurrentDirectory;
//check if we can see the Packages folder
if(!Directory.Exists(basePath + @"\Packages"))
Console.WriteLine("Initial Working Directory: " + workingDirectory);
if(!Directory.Exists(workingDirectory + @"\Packages"))
{
//if we cant, then we are in the wrong directory, so go up a few directories
basePath = Directory.GetParent(workingDirectory).Parent.Parent.Parent.Parent.FullName;
workingDirectory = Directory.GetParent(workingDirectory).Parent.Parent.Parent.FullName;

Check warning on line 52 in CodeCoverage/Program.cs

View workflow job for this annotation

GitHub Actions / build-listing

Dereference of a possibly null reference.

Check warning on line 52 in CodeCoverage/Program.cs

View workflow job for this annotation

GitHub Actions / build-listing

Dereference of a possibly null reference.

Check warning on line 52 in CodeCoverage/Program.cs

View workflow job for this annotation

GitHub Actions / build-listing

Dereference of a possibly null reference.

Check warning on line 52 in CodeCoverage/Program.cs

View workflow job for this annotation

GitHub Actions / build-listing

Dereference of a possibly null reference.
}
Console.WriteLine("Working Directory: " + projectDirectory);
basePath = projectDirectory;
XMLPath = basePath + XMLPath;
Console.WriteLine("Working Directory: " + workingDirectory);
XMLPath = workingDirectory + XMLPath;

//populate the namespace blacklist
namespaceBlacklist.Add("VRC.SDKBase.Validation.*");
Expand Down Expand Up @@ -139,11 +138,11 @@ public static void Main(string[] args)
#endregion

//load assemblys
assemblys.Add(basePath + @"\Packages\com.vrchat.base\Runtime\VRCSDK\Plugins\VRCSDKBase.dll");
assemblys.Add(basePath + @"\Packages\com.vrchat.base\Runtime\VRCSDK\Plugins\VRCSDKBase-Editor.dll");
assemblys.Add(basePath + @"\Packages\com.vrchat.worlds\Runtime\VRCSDK\Plugins\VRCSDK3.dll");
assemblys.Add(basePath + @"\Packages\com.vrchat.worlds\Runtime\VRCSDK\Plugins\VRCSDK3-Editor.dll");
//assemblys.Add(basePath + @"\Packages\com.vrchat.worlds\Runtime\Udon\External\VRC.Udon.Common.dll");
assemblys.Add(workingDirectory + @"\Packages\com.vrchat.base\Runtime\VRCSDK\Plugins\VRCSDKBase.dll");
assemblys.Add(workingDirectory + @"\Packages\com.vrchat.base\Runtime\VRCSDK\Plugins\VRCSDKBase-Editor.dll");
assemblys.Add(workingDirectory + @"\Packages\com.vrchat.worlds\Runtime\VRCSDK\Plugins\VRCSDK3.dll");
assemblys.Add(workingDirectory + @"\Packages\com.vrchat.worlds\Runtime\VRCSDK\Plugins\VRCSDK3-Editor.dll");
//assemblys.Add(workingDirectory + @"\Packages\com.vrchat.worlds\Runtime\Udon\External\VRC.Udon.Common.dll");

//generate the source code for documentation purposes
GenerateSourceCode();
Expand Down Expand Up @@ -309,9 +308,9 @@ private static void BlankDocGen(List<namespaceAssemblyData> assemblyData, string
Console.WriteLine(string.Format("{0}Found {1} fields, {2} propertys, {3} methods, {4} events, {5} types to generate for {6}{7}", orange, fieldsGen.Count, propertysGen.Count, methodsGen.Count, eventsGen.Count, typesGen.Count, pathToGenerate, reset));

//generate a XML file next to where this is
//string xmlPath = basePath + @"\GeneratedXML\" + pathToGenerate + ".xml";
//string xmlPath = workingDirectory + @"\GeneratedXML\" + pathToGenerate + ".xml";
//generate the name as just the class name
string xmlPath = basePath + @"\GeneratedXML\" + pathToGenerate.Split('.').Last() + ".xml";
string xmlPath = workingDirectory + @"\GeneratedXML\" + pathToGenerate.Split('.').Last() + ".xml";

//make sure the folder exists
Directory.CreateDirectory(Path.GetDirectoryName(xmlPath));
Expand Down Expand Up @@ -408,7 +407,7 @@ private static void GenerateSourceCode()
Console.WriteLine("Generating source code...");

//clear the folder of previous C# files
string decompiledSourcePath = basePath + @"\DecompiledSource";
string decompiledSourcePath = workingDirectory + @"\DecompiledSource";
if (Directory.Exists(decompiledSourcePath))
{
Directory.Delete(decompiledSourcePath, true);
Expand All @@ -426,7 +425,7 @@ private static void GenerateSourceCode()
string code = decompiler.DecompileWholeModuleAsString();

//save the code to a folder
string path = basePath + @"\DecompiledSource\" + Path.GetFileNameWithoutExtension(assembly) + ".cs";
string path = workingDirectory + @"\DecompiledSource\" + Path.GetFileNameWithoutExtension(assembly) + ".cs";

//make sure folder exists
Directory.CreateDirectory(Path.GetDirectoryName(path));
Expand All @@ -435,7 +434,7 @@ private static void GenerateSourceCode()
}

//make a gitignore file
string gitignore = basePath + @"\DecompiledSource\.gitignore";
string gitignore = workingDirectory + @"\DecompiledSource\.gitignore";
File.WriteAllText(gitignore, "*");

Console.WriteLine("Generated source code");
Expand Down
Binary file modified CodeCoverage/bin/Debug/net8.0/CodeCoverage.dll
Binary file not shown.
Binary file modified CodeCoverage/bin/Debug/net8.0/CodeCoverage.exe
Binary file not shown.
2 changes: 1 addition & 1 deletion CodeCoverage/obj/Debug/net8.0/CodeCoverage.AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
[assembly: System.Reflection.AssemblyCompanyAttribute("CodeCoverage")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+ccf1c3f825825cc43eaf05900ae8c4e963ef30b7")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+a83cd29e4c6d5e46dbb32bf4cd6594cae534dc9f")]
[assembly: System.Reflection.AssemblyProductAttribute("CodeCoverage")]
[assembly: System.Reflection.AssemblyTitleAttribute("CodeCoverage")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
fd1bb6b085b11ef633969313b6203ebe27f918f1eca6a18bebc4864244a99ac6
813f3527f016ecbac803d3d04e03564a386c600cbefe2369d933796180be245a
Binary file modified CodeCoverage/obj/Debug/net8.0/CodeCoverage.dll
Binary file not shown.
2 changes: 1 addition & 1 deletion CodeCoverage/obj/Debug/net8.0/CodeCoverage.sourcelink.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"documents":{"C:\\Users\\mherber\\Documents\\VRCSDK-Documentation-Project\\*":"https://raw.githubusercontent.com/Happyrobot33/VRCSDK-Documentation-Project/ccf1c3f825825cc43eaf05900ae8c4e963ef30b7/*"}}
{"documents":{"C:\\Users\\mherber\\Documents\\VRCSDK-Documentation-Project\\*":"https://raw.githubusercontent.com/Happyrobot33/VRCSDK-Documentation-Project/a83cd29e4c6d5e46dbb32bf4cd6594cae534dc9f/*"}}
Binary file modified CodeCoverage/obj/Debug/net8.0/apphost.exe
Binary file not shown.
Binary file modified CodeCoverage/obj/Debug/net8.0/ref/CodeCoverage.dll
Binary file not shown.
Binary file modified CodeCoverage/obj/Debug/net8.0/refint/CodeCoverage.dll
Binary file not shown.

0 comments on commit 7de423c

Please sign in to comment.