diff options
Diffstat (limited to 'Software/Tango.NET/Tango.Core/PathHelper.cs')
| -rw-r--r-- | Software/Tango.NET/Tango.Core/PathHelper.cs | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/Software/Tango.NET/Tango.Core/PathHelper.cs b/Software/Tango.NET/Tango.Core/PathHelper.cs new file mode 100644 index 000000000..08dbf1c16 --- /dev/null +++ b/Software/Tango.NET/Tango.Core/PathHelper.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.Core +{ + public static class PathHelper + { + public static String GetTempFolderPath() + { + String tempDirectory = Path.Combine(Path.GetTempPath(), "Twine", Path.GetRandomFileName()); + Directory.CreateDirectory(tempDirectory); + return tempDirectory; + } + + public static bool TryDeleteFolder(String path) + { + try + { + Directory.Delete(path, true); + return true; + } + catch + { + return false; + } + } + } +} |
