using System;
using System.IO;
using System.Reflection;
namespace IStation
{
///
/// 文件辅助类
///
public class DataFolderHelper
{
///
/// 根目录
///
private static string _root_directory;
public static bool IsExeExcute = true;//独立运行还是嵌入运行
///
/// 查询数据文件夹路径
///
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;
}
}
}