diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-05-09 18:07:56 +0300 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-05-09 18:07:56 +0300 |
| commit | e1236499b485a69648bea4d7871aa185e5dae745 (patch) | |
| tree | 8cd4ccd7d272c8c4e61d4bd6bcba434eb9522b85 /Software/Visual_Studio/Tango.Protobuf | |
| parent | 2a459c79e90a2ade3f1dac1ae4541c0f4d74965c (diff) | |
| download | Tango-e1236499b485a69648bea4d7871aa185e5dae745.tar.gz Tango-e1236499b485a69648bea4d7871aa185e5dae745.zip | |
New TemporaryManager !
Diffstat (limited to 'Software/Visual_Studio/Tango.Protobuf')
| -rw-r--r-- | Software/Visual_Studio/Tango.Protobuf/Compilers/CCompiler.cs | 11 | ||||
| -rw-r--r-- | Software/Visual_Studio/Tango.Protobuf/ProtoCompiler.cs | 9 |
2 files changed, 11 insertions, 9 deletions
diff --git a/Software/Visual_Studio/Tango.Protobuf/Compilers/CCompiler.cs b/Software/Visual_Studio/Tango.Protobuf/Compilers/CCompiler.cs index fa0f130ac..1a8dc632f 100644 --- a/Software/Visual_Studio/Tango.Protobuf/Compilers/CCompiler.cs +++ b/Software/Visual_Studio/Tango.Protobuf/Compilers/CCompiler.cs @@ -5,6 +5,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using Tango.Core.Helpers; +using Tango.Core.IO; namespace Tango.Protobuf.Compilers { @@ -49,12 +50,12 @@ namespace Tango.Protobuf.Compilers /// </returns> public override CompilerFolderResult CompileFolder(string sourceFolder, params String[] includeFolders) { - String temp = PathHelper.GetTempFolderPath(); - PathHelper.CopyDirectory(sourceFolder, temp, true); + var temp = TemporaryManager.Default.CreateFolder(); + PathHelper.CopyDirectory(sourceFolder, temp.Path, true); List<String> directories = Directory.GetDirectories(sourceFolder, "*", SearchOption.AllDirectories).Where(x => includeFolders == null || includeFolders.Length == 0 || includeFolders.Contains(Path.GetFileName(x))).ToList(); - foreach (var dir in Directory.GetDirectories(temp)) + foreach (var dir in Directory.GetDirectories(temp.Path)) { if (!directories.Select(x => Path.GetFileName(x)).Contains(Path.GetFileName(dir))) { @@ -62,7 +63,7 @@ namespace Tango.Protobuf.Compilers } } - foreach (var file in Directory.GetFiles(temp, "*.proto", SearchOption.AllDirectories)) + foreach (var file in Directory.GetFiles(temp.Path, "*.proto", SearchOption.AllDirectories)) { String str = File.ReadAllText(file); @@ -77,7 +78,7 @@ namespace Tango.Protobuf.Compilers File.WriteAllText(file, str); } - return base.CompileFolder(temp); + return base.CompileFolder(temp.Path); } } } diff --git a/Software/Visual_Studio/Tango.Protobuf/ProtoCompiler.cs b/Software/Visual_Studio/Tango.Protobuf/ProtoCompiler.cs index 65ce25300..d58d21ea9 100644 --- a/Software/Visual_Studio/Tango.Protobuf/ProtoCompiler.cs +++ b/Software/Visual_Studio/Tango.Protobuf/ProtoCompiler.cs @@ -7,6 +7,7 @@ using System.Reflection; using System.Text; using System.Threading.Tasks; using Tango.Core.Helpers; +using Tango.Core.IO; using Tango.Logging; namespace Tango.Protobuf @@ -56,7 +57,7 @@ namespace Tango.Protobuf { logManager.Log("Compiling file " + inputFile); - String tmpPath = PathHelper.GetTempFolderPath(); + var tmpPath = TemporaryManager.Default.CreateFolder(); logManager.Log("Temp path: " + tmpPath); @@ -123,7 +124,7 @@ namespace Tango.Protobuf } - if (PathHelper.TryDeleteFolder(tmpPath)) + if (tmpPath.Delete()) { logManager.Log("Removed temp path: " + tmpPath); } @@ -230,7 +231,7 @@ namespace Tango.Protobuf ImportsFolders.Clear(); ImportsFolders.AddRange(Directory.GetDirectories(sourceFolder, "*.*", SearchOption.AllDirectories)); - String tempPath = PathHelper.GetTempFolderPath(); + var tempPath = TemporaryManager.Default.CreateFolder(); foreach (var file in Directory.GetFiles(sourceFolder, "*.proto", SearchOption.AllDirectories)) { @@ -247,7 +248,7 @@ namespace Tango.Protobuf var result = CompileFolderDefault(tempPath, tempPath, fileResults); - PathHelper.TryDeleteFolder(tempPath); + tempPath.Delete(); logManager.Log(Path.GetFileName(sourceFolder) + "compiled!"); |
