Tesseract 3.02

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Functions
basedir.h File Reference
`#include "platform.h"`
`#include "strngs.h"`

Go to the source code of this file.

## Functions

TESS_API void | truncate_path (const char *code_path, STRING *trunc_path)

## Function Documentation

TESS_API void truncate_path | ( | const char * | code_path,
|  | STRING * | trunc_path
| ) |  |

Definition at line 32 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 = "./";
}