tangxu
2024-03-09 ebe1b29ddb5ad27698487cd830b42a042ff28c3a
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
33
34
35
36
using System;
using System.IO;
using System.Reflection;
 
namespace IStation 
{
    /// <summary>
    /// 文件辅助类
    /// </summary>
    public class DataFolderHelper
    {
        /// <summary>
        /// 根目录
        /// </summary>
 
        private static string _root_directory;
 
 
 
        /// <summary>
        /// 查询数据文件夹路径
        /// </summary>
        public static string GetRootPath()
        { 
            if (string.IsNullOrEmpty(_root_directory))
            {
                //var directory = new DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory).FullName;
                var directory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
                _root_directory = Path.Combine(directory, "Data"); 
            }
            return _root_directory;  
        }
 
 
    }
}