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