FastReport

Форк
0
34 строки · 969.0 Байт
1
using System.IO;
2
using System.Reflection;
3

4
namespace ConsoleAppsUtils
5
{
6
    public static class Utils
7
    {
8
        private static string GetDirectory(string subPath)
9
        {
10
            if (subPath == null)
11
                return Path.GetDirectoryName(Assembly.GetCallingAssembly().Location);
12
            return Path.Combine(Path.GetDirectoryName(Assembly.GetCallingAssembly().Location), subPath);
13
        }
14

15
        public static string FindDirectory(string directory1)
16
        {
17
            string thisFolder = GetDirectory(null);
18
            try
19
            {
20
                for (int i = 0; i < 50; i++)
21
                {
22

23
                    string dir = Path.Combine(thisFolder, directory1);
24
                    if (Directory.Exists(dir))
25
                        return dir;
26
                    thisFolder = Directory.GetParent(thisFolder).FullName;
27

28
                }
29
            }
30
            catch { return ""; }
31
            return "";
32
        }
33
    }
34
}
35

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.