aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Tango.NET/Tango.Core/PathHelper.cs
blob: 08dbf1c16563e6616d492338738343cf9fb78a4c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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;
            }
        }
    }
}