#include "basedir.h"
#include <stdlib.h>
#include "mfcpch.h"
Go to the source code of this file.
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;
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)
else
*trunc_path = "./";
}