tangxu
2024-05-03 95e5af5abc03855693decf4ddc6f4083ec140132
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 = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
                    _root_directory = Path.Combine(directory, "Data");
                
            }
            return _root_directory;  
        }
 
 
    }
}