tesseract
3.03
|
Go to the source code of this file.
Functions | |
TESS_API void | truncate_path (const char *code_path, STRING *trunc_path) |
TESS_API void truncate_path | ( | const char * | code_path, |
STRING * | trunc_path | ||
) |
Definition at line 30 of file basedir.cpp.
{ int trunc_index = -1; if (code_path != NULL) { const char* last_slash = strrchr(code_path, '/'); if (last_slash != NULL && last_slash + 1 - code_path > trunc_index) trunc_index = last_slash + 1 - code_path; last_slash = strrchr(code_path, '\\'); if (last_slash != NULL && last_slash + 1 - code_path > trunc_index) trunc_index = last_slash + 1 - code_path; } *trunc_path = code_path; if (trunc_index >= 0) trunc_path->truncate_at(trunc_index); else *trunc_path = "./"; }