public override ABnfGuessError CheckError() { // 检查最后的分号 if (m_element.GetString() == null) { return(new ABnfGuessError(m_element, "import必须以;结尾")); } ABnfElement child = m_element.GetText(); if (child == null) { return(null); } var project = m_file.GetProjectInfo() as AProtobufProjectInfo; if (project == null) { return(null); } var value = child.GetElementString(); var full_path = project.GetProjectPath() + value; if (File.Exists(full_path)) { return(null); } var file = project.FindImportFile(value); if (file != null) { full_path = file.GetFullPath(); if (File.Exists(full_path)) { return(null); } } // 获取当前文件所在的文件夹,然后补上value full_path = Path.GetDirectoryName(m_element.GetFullPath()) + "\\" + value.Replace('/', '\\'); if (File.Exists(full_path)) { return(null); } return(new ABnfGuessError(child, "import的文件不存在")); }
public override ABnfGuessError CheckError() { ABnfElement child = m_element.GetText(); if (child == null) { return(null); } var project = m_file.GetProjectInfo() as AProtobufProjectInfo; if (project == null) { return(null); } var value = child.GetElementString(); var full_path = project.GetProjectPath() + value; if (File.Exists(full_path)) { return(null); } var file = project.FindImportFile(value); if (file != null) { full_path = file.GetFullPath(); if (File.Exists(full_path)) { return(null); } } return(new ABnfGuessError(child, "Import的文件不存在")); }