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 bool IsExeExcute = true;
|
|
/// <summary>
|
/// 查询数据文件夹路径
|
/// </summary>
|
public static string GetRootPath()
|
{
|
if (string.IsNullOrEmpty(_root_directory))
|
{
|
if(IsExeExcute)
|
{
|
var directory = new DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory).FullName;
|
_root_directory = Path.Combine(directory, "Data");
|
}
|
else
|
{
|
var directory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
|
_root_directory = Path.Combine(directory, "Data");
|
}
|
}
|
return _root_directory;
|
}
|
|
|
}
|
}
|