diff --git a/TGServerService/Program.cs b/TGServerService/Program.cs index dce1973967..cd7e73e652 100644 --- a/TGServerService/Program.cs +++ b/TGServerService/Program.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.IO; @@ -42,11 +42,8 @@ namespace TGServerService if (excludeRoot != null) for (var I = 0; I < excludeRoot.Count; ++I) excludeRoot[I] = excludeRoot[I].ToLower(); - if (!di.Attributes.HasFlag(FileAttributes.Directory)) - { //this is probably a symlink - Directory.Delete(di.FullName); + if (CheckDeleteSymlinkDir(di)) return; - } NormalizeAndDelete(di, excludeRoot); if (!ContentsOnly) { @@ -56,6 +53,22 @@ namespace TGServerService } } + + /// + /// Properly unlinks directory if it is a symlink + /// + /// for the directory in question + /// if was a symlink and deleted, otherwise + static bool CheckDeleteSymlinkDir(DirectoryInfo di) + { + if (!di.Attributes.HasFlag(FileAttributes.Directory)) + { //this is probably a symlink + Directory.Delete(di.FullName); + return true; + } + return false; + } + /// /// Recursively empty a directory /// @@ -67,6 +80,8 @@ namespace TGServerService { if (excludeRoot != null && excludeRoot.Contains(subDir.Name.ToLower())) continue; + if (CheckDeleteSymlinkDir(subDir)) + continue; NormalizeAndDelete(subDir, null); subDir.Delete(true); } diff --git a/TGServerService/ServerInstance/Compiler.cs b/TGServerService/ServerInstance/Compiler.cs index dc29bcd5a5..06fe225266 100644 --- a/TGServerService/ServerInstance/Compiler.cs +++ b/TGServerService/ServerInstance/Compiler.cs @@ -25,8 +25,6 @@ namespace TGServerService const string StaticDirs = "Static"; const string StaticBackupDir = "Static_BACKUP"; - const string LibMySQLFile = "/libmysql.dll"; - const string GameDir = "Game"; const string GameDirA = GameDir + "/A"; const string GameDirB = GameDir + "/B"; @@ -122,7 +120,7 @@ namespace TGServerService //what is says on the tin CompilerStatus IsInitialized() { - if (File.Exists(RelativePath(GameDirLive + LibMySQLFile))) //its a good tell, jim + if (File.Exists(RelativePath(Path.Combine(GameDirLive, InterfaceDLLName)))) //its a good tell, jim return CompilerStatus.Initialized; return CompilerStatus.Uninitialized; }