crosslang-libs/crosslang-shell-install.tcross

30 lines
1.2 KiB
Plaintext
Raw Normal View History

2024-12-30 13:09:42 +00:00
func downloadPackage(name,version,path)
{
2024-12-30 13:20:30 +00:00
var uri = $"https://cpkg.tesseslanguage.com/api/v1/download?name={Net.Http.UrlEncode(name)}&version={Net.Http.UrlEncode(version)}";
var req = Net.Http.MakeRequest(uri);
if(req.StatusCode == 200)
{
var strm = FS.MemoryStream(true);
req.CopyToStream(strm);
var f = FS.Local.OpenFile(path,"wb");
strm.Seek(0,0);
strm.CopyTo(f);
f.Close();
strm.Close();
req.Close();
}
else
{
throw $"Error when downloading package {name} with version {version}";
}
2024-12-30 13:09:42 +00:00
}
var shellDir = Path.FromString(Env.Config) / "Tesses" / "CrossLang" / "Shell";
FS.Local.CreateDirectory(shellDir);
downloadPackage("Tesses.CrossLang.Shell", "1.0.0.0-prod", shellDir / "Shell.crvm");
downloadPackage("Tesses.CrossLang.Args", "1.0.0.0-prod", shellDir / "Tesses.CrossLang.Args-1.0.0.0-prod.crvm");
downloadPackage("Tesses.CrossLang.Args", "1.0.0.0-prod", shellDir / "Tesses.CrossLang.BuildEssentials-1.0.0.0-prod.crvm");