Fixed bug at18021 (hondaman)

Fixed bug at18924 (Arnold)
This commit is contained in:
David Anderson 2005-09-18 03:26:26 +00:00
parent 324f4c58a8
commit ae8bf10746
5 changed files with 30 additions and 18 deletions

View File

@ -14,6 +14,11 @@ public virtual void OnBuild()
{
}
public virtual void CreateDir(string dir)
{
Directory.CreateDirectory(dir);
}
public virtual bool Build(Config cfg, Build build)
{
m_Cfg = cfg;
@ -51,7 +56,7 @@ public virtual bool BuildMod(AMod mod)
string basedir = PropSlashes(m_Cfg.OutputPath() + "\\" + mod.GetModPath());
string sourcetree = m_Cfg.GetSourceTree();
if (!mod.CopyExtraFiles(basedir, sourcetree))
if (!mod.CopyExtraFiles(this, basedir, sourcetree))
return false;
return true;
@ -62,7 +67,7 @@ public virtual void CopyConfigs(AMod mod)
string basedir = PropSlashes(m_Cfg.OutputPath() + "\\" + mod.GetModPath() + "\\configs");
if (!Directory.Exists(basedir))
Directory.CreateDirectory(basedir);
CreateDir(basedir);
string srcdir = PropSlashes(m_Cfg.GetSourceTree() + "\\configs");
@ -74,15 +79,15 @@ public virtual void CopyConfigs(AMod mod)
srcdir = PropSlashes(srcdir);
CopyNormal(srcdir, basedir);
CopyNormal(this, srcdir, basedir);
}
public static void CopyNormal(string src, string dest)
public static void CopyNormal(ABuilder ab, string src, string dest)
{
string[] files = Directory.GetFiles(src);
if (!Directory.Exists(dest))
Directory.CreateDirectory(dest);
ab.CreateDir(dest);
for (int i=0; i<files.Length; i++)
{
@ -117,7 +122,7 @@ public virtual bool BuildModPlugins(AMod mod)
}
dir = PropSlashes(basedir + "\\" + plugin.outdir);
if (!Directory.Exists(dir))
Directory.CreateDirectory(dir);
CreateDir(dir);
target = PropSlashes(dir + "\\" + plugin.name + ".amxx");
if (File.Exists(target))
File.Delete(target);
@ -137,7 +142,7 @@ public virtual bool BuildModPlugins(AMod mod)
{
string[] files = Directory.GetFiles(search_dir);
if (!Directory.Exists(PropSlashes(basedir + "\\scripting")))
Directory.CreateDirectory(PropSlashes(basedir + "\\scripting"));
CreateDir(PropSlashes(basedir + "\\scripting"));
for (int i=0; i<files.Length; i++)
{
dest = PropSlashes(basedir + "\\scripting\\" + GetFileName(files[i]));
@ -188,7 +193,7 @@ public virtual bool BuildModModules(AMod mod)
}
dir = PropSlashes(basedir + "\\" + module.outdir);
if (!Directory.Exists(dir))
Directory.CreateDirectory(dir);
CreateDir(dir);
File.Copy(binary,
PropSlashes(dir + "\\" + module.projname + GetLibExt()),
true);

View File

@ -70,7 +70,7 @@ public AMod()
//called when it's okay to build an extra dir structure
// and copy files to it
public virtual bool CopyExtraFiles(string basedir, string sourcedir)
public virtual bool CopyExtraFiles(ABuilder ab, string basedir, string sourcedir)
{
return true;
}

View File

@ -48,35 +48,35 @@ public override sealed bool ExcludeCopy(string file)
}
public override sealed bool CopyExtraFiles(string basedir, string source)
public override sealed bool CopyExtraFiles(ABuilder ab, string basedir, string source)
{
//Create directory structures
string datadir = basedir + "\\data";
if (!Directory.Exists(ABuilder.PropSlashes(datadir)))
Directory.CreateDirectory(ABuilder.PropSlashes(datadir));
ab.CreateDir(ABuilder.PropSlashes(datadir));
File.Copy(ABuilder.PropSlashes(source + "\\dlls\\geoip\\GeoIP.dat"),
ABuilder.PropSlashes(datadir + "\\GeoIP.dat"),
true);
ABuilder.CopyNormal(
ABuilder.CopyNormal(ab,
ABuilder.PropSlashes(source + "\\plugins\\lang"),
ABuilder.PropSlashes(datadir + "\\lang")
);
if (!Directory.Exists(ABuilder.PropSlashes(basedir + "\\logs")))
Directory.CreateDirectory(ABuilder.PropSlashes(basedir + "\\logs"));
ab.CreateDir(ABuilder.PropSlashes(basedir + "\\logs"));
if (!Directory.Exists(ABuilder.PropSlashes(basedir + "\\doc")))
Directory.CreateDirectory(ABuilder.PropSlashes(basedir + "\\doc"));
ab.CreateDir(ABuilder.PropSlashes(basedir + "\\doc"));
File.Copy(
ABuilder.PropSlashes(source + "\\doc\\amxmodx-doc.chm"),
ABuilder.PropSlashes(basedir + "\\doc\\amxmodx-doc.chm"),
true);
ABuilder.CopyNormal(
ABuilder.CopyNormal(ab,
ABuilder.PropSlashes(source + "\\plugins\\include"),
ABuilder.PropSlashes(basedir + "\\scripting\\include"));

View File

@ -29,9 +29,16 @@ public override void CompressDir(string target, string dir)
for (int i=0; i<files.Length; i++)
file_list += GetFileName(files[i]) + " ";
ProcessStartInfo chmod = new ProcessStartInfo();
chmod.FileName = "/bin/chmod";
chmod.WorkingDirectory = dir;
chmod.Arguments = "-R 755 " + file_list;
chmod.UseShellExecute = false;
Process c = Process.Start(chmod);
c.WaitForExit();
info.Arguments = "zcvf " + target + ".tar.gz " + file_list;
Console.WriteLine(info.WorkingDirectory);
Console.WriteLine(info.Arguments);
info.UseShellExecute = false;
Process p = Process.Start(info);

View File

@ -31,7 +31,7 @@ private void AddPlugins()
m_Plugins.Add(csstats);
}
public override sealed bool CopyExtraFiles(string basedir, string source)
public override sealed bool CopyExtraFiles(ABuilder ab, string basedir, string source)
{
if ((int)System.Environment.OSVersion.Platform == 128)