forked from Unity-Technologies/Unity.Mathematics
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
38 lines (32 loc) · 1.32 KB
/
Copy pathProgram.cs
File metadata and controls
38 lines (32 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
using System;
using System.IO;
namespace Unity.Mathematics.Mathematics.CodeGen
{
class MainClass
{
public static void Main (string[] args)
{
var thisExeDir = Path.GetDirectoryName(typeof(MainClass).Assembly.Location);
if (thisExeDir == null)
{
throw new InvalidOperationException($"Unable to get path of current assembly from `{typeof(MainClass).Assembly.Location}`");
}
var directory = new DirectoryInfo(thisExeDir);
// go from `src/Unity.Mathematics.CodeGen/bin/Debug`
// to `src/`, so 3 directories
var parent = directory.Parent?.Parent?.Parent;
if (parent == null)
{
throw new InvalidOperationException($"Unable to get path of current assembly from `{typeof(MainClass).Assembly.Location}`");
}
directory = new DirectoryInfo(Path.Combine(parent.FullName, "Unity.Mathematics"));
if (!directory.Exists)
{
throw new InvalidOperationException($"The directory `{directory.FullName}` must exist");
}
Console.WriteLine("Generating swizzle and operators: " + directory);
VectorGenerator.Write(directory.FullName);
Console.WriteLine("Done");
}
}
}