public static bool openZbsDebugger = false; //是否连接ZeroBraneStudio调试 /// <summary> /// 添加Lua文件搜索目录 /// </summary> public static void AddSearchDir() { if (!Directory.Exists(LuaConst.toluaDir)) { string msg = string.Format("toluaDir path not exists: {0}, configer it in LuaConst.cs", LuaConst.toluaDir); throw new LuaException(msg); } LuaState.AddSearchPathStatic(LuaConst.toluaDir); //添加项目Lua文件路径 foreach (string luaDir in luaDirs) { addAllDir(luaDir); } }
/// <summary> /// 添加所有子目录路径 /// </summary> /// <param name="rootDir"></param> private static void addAllDir(string rootDir) { if (!Directory.Exists(rootDir)) { string msg = string.Format("luaDir path not exists: {0}, configer it in LuaConst.cs", rootDir); throw new LuaException(msg); } string[] subDirs = Directory.GetDirectories(rootDir, "*", SearchOption.AllDirectories); foreach (string subDir in subDirs) { string dir = subDir.Replace("\\", "/"); LuaState.AddSearchPathStatic(dir); } LuaState.AddSearchPathStatic(rootDir); }