Compare commits
4 Commits
v1.0.35-ma
...
v1.0.37-ma
Author | SHA1 | Date | |
---|---|---|---|
![]() |
f42b9c6674 | ||
![]() |
227557f421 | ||
![]() |
0632f68aaf | ||
![]() |
0a9f299527 |
@@ -87,13 +87,25 @@ namespace Torch.Server
|
||||
TorchLauncher.Launch(workingDir, binDir);
|
||||
|
||||
CopyNative(binDir);
|
||||
|
||||
initializer.Run(isService, instanceName, instancePath);
|
||||
}
|
||||
|
||||
private static void CopyNative(string binPath)
|
||||
{
|
||||
var log = LogManager.GetLogger("TorchLauncher");
|
||||
|
||||
var workingDir = new DirectoryInfo(Directory.GetCurrentDirectory());
|
||||
if (workingDir.Attributes.HasFlag(FileAttributes.ReadOnly))
|
||||
{
|
||||
log.Warn("Game directory is readonly. You should copy steam_api64.dll, Havok.dll from bin manually");
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var apiSource = Path.Combine(binPath, "steam_api64.dll");
|
||||
var apiTarget = Path.Combine(AppContext.BaseDirectory, "steam_api64.dll");
|
||||
var apiTarget = Path.Combine(workingDir.FullName, "steam_api64.dll");
|
||||
if (!File.Exists(apiTarget))
|
||||
{
|
||||
File.Copy(apiSource, apiTarget);
|
||||
@@ -105,7 +117,7 @@ namespace Torch.Server
|
||||
}
|
||||
|
||||
var havokSource = Path.Combine(binPath, "Havok.dll");
|
||||
var havokTarget = Path.Combine(AppContext.BaseDirectory, "Havok.dll");
|
||||
var havokTarget = Path.Combine(workingDir.FullName, "Havok.dll");
|
||||
|
||||
if (!File.Exists(havokTarget))
|
||||
{
|
||||
@@ -117,5 +129,14 @@ namespace Torch.Server
|
||||
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