Compare commits
4 Commits
v1.0.35-ma
...
v1.0.37-ma
Author | SHA1 | Date | |
---|---|---|---|
![]() |
f42b9c6674 | ||
![]() |
227557f421 | ||
![]() |
0632f68aaf | ||
![]() |
0a9f299527 |
@@ -87,34 +87,55 @@ namespace Torch.Server
|
|||||||
TorchLauncher.Launch(workingDir, binDir);
|
TorchLauncher.Launch(workingDir, binDir);
|
||||||
|
|
||||||
CopyNative(binDir);
|
CopyNative(binDir);
|
||||||
|
|
||||||
initializer.Run(isService, instanceName, instancePath);
|
initializer.Run(isService, instanceName, instancePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void CopyNative(string binPath)
|
private static void CopyNative(string binPath)
|
||||||
{
|
{
|
||||||
var apiSource = Path.Combine(binPath, "steam_api64.dll");
|
var log = LogManager.GetLogger("TorchLauncher");
|
||||||
var apiTarget = Path.Combine(AppContext.BaseDirectory, "steam_api64.dll");
|
|
||||||
if (!File.Exists(apiTarget))
|
|
||||||
{
|
|
||||||
File.Copy(apiSource, apiTarget);
|
|
||||||
}
|
|
||||||
else if (File.GetLastWriteTime(apiTarget) < File.GetLastWriteTime(binPath))
|
|
||||||
{
|
|
||||||
File.Delete(apiTarget);
|
|
||||||
File.Copy(apiSource, apiTarget);
|
|
||||||
}
|
|
||||||
|
|
||||||
var havokSource = Path.Combine(binPath, "Havok.dll");
|
var workingDir = new DirectoryInfo(Directory.GetCurrentDirectory());
|
||||||
var havokTarget = Path.Combine(AppContext.BaseDirectory, "Havok.dll");
|
if (workingDir.Attributes.HasFlag(FileAttributes.ReadOnly))
|
||||||
|
|
||||||
if (!File.Exists(havokTarget))
|
|
||||||
{
|
{
|
||||||
File.Copy(havokSource, havokTarget);
|
log.Warn("Game directory is readonly. You should copy steam_api64.dll, Havok.dll from bin manually");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else if (File.GetLastWriteTime(havokTarget) < File.GetLastWriteTime(havokSource))
|
|
||||||
{
|
try
|
||||||
File.Delete(havokTarget);
|
{
|
||||||
File.Copy(havokSource, havokTarget);
|
var apiSource = Path.Combine(binPath, "steam_api64.dll");
|
||||||
|
var apiTarget = Path.Combine(workingDir.FullName, "steam_api64.dll");
|
||||||
|
if (!File.Exists(apiTarget))
|
||||||
|
{
|
||||||
|
File.Copy(apiSource, apiTarget);
|
||||||
|
}
|
||||||
|
else if (File.GetLastWriteTime(apiTarget) < File.GetLastWriteTime(binPath))
|
||||||
|
{
|
||||||
|
File.Delete(apiTarget);
|
||||||
|
File.Copy(apiSource, apiTarget);
|
||||||
|
}
|
||||||
|
|
||||||
|
var havokSource = Path.Combine(binPath, "Havok.dll");
|
||||||
|
var havokTarget = Path.Combine(workingDir.FullName, "Havok.dll");
|
||||||
|
|
||||||
|
if (!File.Exists(havokTarget))
|
||||||
|
{
|
||||||
|
File.Copy(havokSource, havokTarget);
|
||||||
|
}
|
||||||
|
else if (File.GetLastWriteTime(havokTarget) < File.GetLastWriteTime(havokSource))
|
||||||
|
{
|
||||||
|
File.Delete(havokTarget);
|
||||||
|
File.Copy(havokSource, havokTarget);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (UnauthorizedAccessException)
|
||||||
|
{
|
||||||
|
// file is being used by another process, probably previous torch has not been closed yet
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
log.Error(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user