-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathBrowserContentBuildProcessor .cs
More file actions
63 lines (55 loc) · 2.5 KB
/
BrowserContentBuildProcessor .cs
File metadata and controls
63 lines (55 loc) · 2.5 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
using System.IO;
using UnityEditor.Build;
using UnityEditor.Build.Reporting;
namespace Assets.DnbSimple.Scripts
{
internal class BrowserContentBuildProcessor : IPostprocessBuildWithReport
{
public int callbackOrder { get { return 0; } }
public void OnPostprocessBuild(BuildReport report)
{
string outputPath = Path.GetDirectoryName(report.summary.outputPath);
const string sourceLicenseFilePath = "Assets/Editor/dotnetbrowser.license";
if (File.Exists(sourceLicenseFilePath))
{
File.Copy(sourceLicenseFilePath, Path.Combine(outputPath, "dotnetbrowser.license"), true);
}
CreateDirectories(outputPath);
CopyDirectory("Assets/DnbSimple/Html/Menu", Path.Combine(outputPath, "DnbSimple/Html/Menu"));
CopyDirectory("Assets/DnbSimple/Html/Chat", Path.Combine(outputPath, "DnbSimple/Html/Chat"));
CopyDirectory("Assets/DnbFps/Html/Menu", Path.Combine(outputPath, "DnbFps/Html/Menu"));
CopyDirectory("Assets/DnbFps/Html/Menu/Images", Path.Combine(outputPath, "DnbFps/Html/Menu/Images"));
CopyDirectory("Assets/DnbFps/Html/Chat", Path.Combine(outputPath, "DnbFps/Html/Chat"));
}
private void CreateDirectory(string outputPath, string dirName)
{
string path = Path.Combine(outputPath, dirName);
if (!Directory.Exists(path))
Directory.CreateDirectory(path);
}
private void CreateDirectories(string outputPath)
{
CreateDirectory(outputPath, "DnbSimple");
CreateDirectory(outputPath, "DnbSimple/Html");
CreateDirectory(outputPath, "DnbSimple/Html/Menu");
CreateDirectory(outputPath, "DnbSimple/Html/Chat");
CreateDirectory(outputPath, "DnbFps");
CreateDirectory(outputPath, "DnbFps/Html");
CreateDirectory(outputPath, "DnbFps/Html/Menu");
CreateDirectory(outputPath, "DnbFps/Html/Menu/Images");
CreateDirectory(outputPath, "DnbFps/Html/Chat");
}
private void CopyDirectory(string source, string target)
{
string[] files = Directory.GetFiles(source);
foreach (string file in files)
{
if (!file.EndsWith(".meta"))
{
string fileName = Path.GetFileName(file);
File.Copy(file, Path.Combine(target, fileName), true);
}
}
}
}
}