【修复】修复unity项目中彻底移除某个模块后,重新生成代码过程中会尝试删除该模块目录,由于保留了meta文件导致目录删除失败的bug
parent
91bb1b317f
commit
6bcc8e74ce
|
|
@ -90,7 +90,7 @@ namespace Luban.Client.Common.Utils
|
|||
else
|
||||
{
|
||||
s_logger.Info("[remove] dir: {dir}", subDir);
|
||||
Directory.Delete(subDir);
|
||||
FileUtil.DeleteDirectoryRecursive(subDir);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -219,5 +219,24 @@ namespace Luban.Common.Utils
|
|||
}
|
||||
return bytes;
|
||||
}
|
||||
|
||||
public static void DeleteDirectoryRecursive(string rootDir)
|
||||
{
|
||||
string[] files = Directory.GetFiles(rootDir);
|
||||
string[] dirs = Directory.GetDirectories(rootDir);
|
||||
|
||||
foreach (string file in files)
|
||||
{
|
||||
File.SetAttributes(file, FileAttributes.Normal);
|
||||
File.Delete(file);
|
||||
}
|
||||
|
||||
foreach (string dir in dirs)
|
||||
{
|
||||
DeleteDirectoryRecursive(dir);
|
||||
}
|
||||
|
||||
Directory.Delete(rootDir, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ namespace Luban.Job.Cfg.Validators
|
|||
public RefValidator(TType type, string tablesStr)
|
||||
{
|
||||
Type = type;
|
||||
this.Tables = new List<string>(DefUtil.TrimBracePairs(tablesStr).Split(','));
|
||||
this.Tables = DefUtil.TrimBracePairs(tablesStr).Split(',').Select(s => s.Trim()).ToList();
|
||||
}
|
||||
|
||||
public void Validate(ValidatorContext ctx, TType type, DType key)
|
||||
|
|
|
|||
|
|
@ -164,7 +164,7 @@ namespace Luban.Job.Common.Defs
|
|||
|
||||
private void AddModule(string defineFile, XElement me)
|
||||
{
|
||||
var name = XmlUtil.GetOptionalAttribute(me, "name");
|
||||
var name = XmlUtil.GetOptionalAttribute(me, "name")?.Trim();
|
||||
//if (string.IsNullOrEmpty(name))
|
||||
//{
|
||||
// throw new LoadDefException($"xml:{CurImportFile} contains module which's name is empty");
|
||||
|
|
@ -235,7 +235,7 @@ namespace Luban.Job.Common.Defs
|
|||
}
|
||||
var b = new Bean()
|
||||
{
|
||||
Name = XmlUtil.GetRequiredAttribute(e, "name"),
|
||||
Name = XmlUtil.GetRequiredAttribute(e, "name").Trim(),
|
||||
Namespace = CurNamespace,
|
||||
Parent = parent.Length > 0 ? parent : "",
|
||||
TypeId = XmlUtil.GetOptionIntAttribute(e, "id"),
|
||||
|
|
@ -319,7 +319,7 @@ namespace Luban.Job.Common.Defs
|
|||
ValidAttrKeys(defineFile, e, _enumOptionalAttrs, _enumRequiredAttrs);
|
||||
var en = new PEnum()
|
||||
{
|
||||
Name = XmlUtil.GetRequiredAttribute(e, "name"),
|
||||
Name = XmlUtil.GetRequiredAttribute(e, "name").Trim(),
|
||||
Namespace = CurNamespace,
|
||||
Comment = XmlUtil.GetOptionalAttribute(e, "comment"),
|
||||
IsFlags = XmlUtil.GetOptionBoolAttribute(e, "flags"),
|
||||
|
|
|
|||
|
|
@ -81,7 +81,8 @@ namespace Luban.Job.Common.Defs
|
|||
{
|
||||
return null;
|
||||
}
|
||||
return ExternalType.Mappers.Find(m => m.Lan == DefAssemblyBase.LocalAssebmly.CurrentLanguage);
|
||||
|
||||
return ExternalType.Mappers.Find(m => m.Lan == this.AssemblyBase.CurrentLanguage && this.AssemblyBase.CurrentExternalSelectors.Contains(m.Selector));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue