Fixed two minor annoyances

1) Paths in config file are now checked before building is attempted (prevents some potential crashes)
2) The compression routines can now handle spaces in the 'output' path
This commit is contained in:
Scott Ehlert 2006-08-28 03:27:16 +00:00
parent 5c23cf416e
commit cb01ff1dc3
4 changed files with 41 additions and 3 deletions

View File

@ -40,9 +40,9 @@ namespace AMXXRelease
if (m_Cfg.MakeOpts().IndexOf("amd64") != -1)
info.Arguments = "zcvf " + target + "_amd64.tar.gz " + file_list;
info.Arguments = "zcvf \"" + target + "_amd64.tar.gz\" " + file_list;
else
info.Arguments = "zcvf " + target + ".tar.gz " + file_list;
info.Arguments = "zcvf \"" + target + ".tar.gz\" " + file_list;
info.UseShellExecute = false;
Process p = Process.Start(info);

View File

@ -39,6 +39,9 @@ namespace AMXXRelease
return;
}
if (!ValidateConfigPaths())
return;
ABuilder builder = null;
if ((int)System.Environment.OSVersion.Platform == 128)
{
@ -53,6 +56,41 @@ namespace AMXXRelease
builder.Build(m_Cfg, build);
}
private bool ValidateConfigPaths()
{
if ( !File.Exists( ABuilder.PropSlashes(m_Cfg.CompressPath()) ) )
{
Console.WriteLine("Failed to find compression program! Check 'compress' option in config.");
return false;
}
string source = ABuilder.PropSlashes(m_Cfg.GetSourceTree());
if (!Directory.Exists(source))
{
Console.WriteLine("Failed to find source tree! Check 'source' option in config.");
return false;
} else {
// Check subdirectories of source tree to make sure they contain necessary directories
if (!Directory.Exists(ABuilder.PropSlashes(source + "\\amxmodx")) ||
!Directory.Exists(ABuilder.PropSlashes(source + "\\configs")) ||
!Directory.Exists(ABuilder.PropSlashes(source + "\\dlls")) ||
!Directory.Exists(ABuilder.PropSlashes(source + "\\plugins")))
{
Console.WriteLine("Source tree appears invalid! Check 'source' option in config.");
return false;
}
}
if ( !File.Exists( ABuilder.PropSlashes(m_Cfg.DevenvPath()) ) )
{
Console.WriteLine("Failed to find compilation program! Check 'devenv' option in config.");
return false;
}
return true;
}
}
}

View File

@ -20,7 +20,7 @@ namespace AMXXRelease
info.FileName = m_Cfg.CompressPath();
info.WorkingDirectory = dir;
info.Arguments = "-r " + target + ".zip " + "*.*";
info.Arguments = "-r \"" + target + ".zip\" " + "*.*";
info.UseShellExecute = false;
Process p = Process.Start(info);