| 37 | } |
| 38 | |
| 39 | void CDelBOM::ScanDel(void) |
| 40 | { |
| 41 | if (m_sPath.GetLength() == 0) { |
| 42 | MessageBox(NULL, "�ļ�·��Ϊ�գ�", "Error", 0); |
| 43 | return; |
| 44 | } |
| 45 | |
| 46 | acl::scan_dir scan; |
| 47 | if (!scan.open(m_sPath.GetString())) { |
| 48 | MessageBox(NULL, "���ļ�·��ʧ�ܣ�", "Error", 0); |
| 49 | return; |
| 50 | } |
| 51 | |
| 52 | logger("open %s and start scanning for deleting BOM ...", |
| 53 | m_sPath.GetString()); |
| 54 | |
| 55 | const char* pFile; |
| 56 | while ((pFile = scan.next_file(true)) != NULL) { |
| 57 | acl::string path(pFile); |
| 58 | if (path.end_with("resource.h", false)) { |
| 59 | logger(">>skip file: %s", pFile); |
| 60 | } else if (path.end_with(".c") || path.end_with(".h") || |
| 61 | path.end_with(".cpp") || path.end_with(".cxx") || |
| 62 | path.end_with(".hpp") || path.end_with(".hxx") || |
| 63 | path.end_with(".java") || path.end_with(".txt") || |
| 64 | path.end_with(".php") || path.end_with(".html") || |
| 65 | path.end_with(".js") || path.end_with(".css") || |
| 66 | path.end_with(".d") || path.end_with(".py") || |
| 67 | path.end_with(".perl") || path.end_with(".cs") || |
| 68 | path.end_with(".as") || path.end_with(".go") || |
| 69 | path.end_with(".rust") || path.end_with(".erl")) { |
| 70 | |
| 71 | DeleteBOM(path); |
| 72 | } else { |
| 73 | logger(">>skip file: %s", pFile); |
| 74 | } |
| 75 | } |
| 76 | |
| 77 | logger("%s: all text files have been deleted BOM!", m_sPath.GetString()); |
| 78 | } |
| 79 | |
| 80 | bool CDelBOM::DeleteBOM(const acl::string& filePath) |
| 81 | { |