--------------------------------------------------------------------------*/
| 2575 | |
| 2576 | /*--------------------------------------------------------------------------*/ |
| 2577 | int cmListFileLexer_SetFileName(cmListFileLexer* lexer, const char* name, |
| 2578 | cmListFileLexer_BOM* bom) |
| 2579 | { |
| 2580 | int result = 1; |
| 2581 | cmListFileLexerDestroy(lexer); |
| 2582 | if (name) { |
| 2583 | #ifdef _WIN32 |
| 2584 | wchar_t* wname = cmsysEncoding_DupToWide(name); |
| 2585 | lexer->file = _wfopen(wname, L"rb"); |
| 2586 | free(wname); |
| 2587 | #else |
| 2588 | lexer->file = fopen(name, "rb"); |
| 2589 | #endif |
| 2590 | if (lexer->file) { |
| 2591 | if (bom) { |
| 2592 | *bom = cmListFileLexer_ReadBOM(lexer->file); |
| 2593 | } |
| 2594 | } else { |
| 2595 | result = 0; |
| 2596 | } |
| 2597 | } |
| 2598 | cmListFileLexerInit(lexer); |
| 2599 | return result; |
| 2600 | } |
| 2601 | |
| 2602 | /*--------------------------------------------------------------------------*/ |
| 2603 | int cmListFileLexer_SetString(cmListFileLexer* lexer, const char* text) |