-
Notifications
You must be signed in to change notification settings - Fork 11
/
main.toolscompile.cs
110 lines (91 loc) · 3.01 KB
/
main.toolscompile.cs
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
//-----------------------------------------------------------------------------
// Torque 2D.
// Copyright (C) GarageGames.com, Inc.
//-----------------------------------------------------------------------------
function onExit()
{
}
//-----------------------------------------------------------------------------
// Utility function used in findFolders()
//-----------------------------------------------------------------------------
function isIgnoredPath(%path)
{
if (%path $= ".svn" || %path $= "GameDev")
return true;
else
return false;
}
//-----------------------------------------------------------------------------
// Gets a list of all folders, ignoring ignored paths.
//-----------------------------------------------------------------------------
function findFolders()
{
%list = getDirectoryList("/", 0);
%listcount = getWordCount(%list);
// snip ignored paths from the list
for (%i = 0; %i < %listcount; %i++)
{
%folder = getWord(%list, %i);
if (!isIgnoredPath(%folder))
{
%goodlist = %goodlist SPC %folder;
}
}
%goodlist = trim(%goodlist);
return %goodlist;
}
//-----------------------------------------------------------------------------
// Adds each of the paths in a list to the resource manager.
//-----------------------------------------------------------------------------
function setModPaths(%paths)
{
%pathCount = getWordCount(%paths);
for (%i = 0; %i < %pathCount; %i++)
{
%path = getWord(%paths, %i);
addResPath(%path);
}
}
//-----------------------------------------------------------------------------
// Compiles anything that matches %pattern that the resource manager has
// loaded.
//-----------------------------------------------------------------------------
function compileAll(%pattern)
{
%file = findFirstFile(%pattern);
while(%file !$= "")
{
echo(%file);
compile(%file);
%file = findNextFile(%pattern);
}
}
// get a list of all folders, ignoring ignored paths.
echo("Searching for directories in the current working directory... ");
$modpaths = findFolders();
echo("Found these directories:");
echo("----------------------------------------");
echo(strreplace($modpaths, " ", "\n"));
echo("----------------------------------------");
// load paths into the resource manager.
echo("\nLoading paths into the resource manager...");
setModPaths($modpaths);
$Scripts::OverrideDSOPath = expandPath("");
// compile all standard .cs
echo("----------------------------------------");
echo("Compiling Editor Scripts");
echo("----------------------------------------");
compileAll("*.cs");
// compile all ed.cs
echo("----------------------------------------");
echo("Compiling Editor Scripts");
echo("----------------------------------------");
compileAll("*.ed.cs");
// compile all ed.gui
echo("----------------------------------------");
echo("Compiling Editor Guis");
echo("----------------------------------------");
compileAll("*.ed.gui");
// quit
echo("\n Done, quitting.");
quit();