mirror of
https://gitlab.freedesktop.org/uchardet/uchardet.git
synced 2026-01-01 03:12:24 +08:00
test: fix test binary build for Windows.
realpath() doesn't exist on Windows. Replace it with _fullpath() which does the same thing, as far as I can see (at least for creating an absolute path, it doesn't seem to canonicalize the path, or the docs doesn't say it, yet since we are controlling the arguments from our CMake script, it's not a big problem anyway). This fixed the CI build for Windows failing with: > undefined reference to `realpath'
This commit is contained in:
parent
5cf3c648fb
commit
bffb7819d2
@ -45,6 +45,13 @@
|
|||||||
|
|
||||||
#define BUFFER_SIZE 65536
|
#define BUFFER_SIZE 65536
|
||||||
|
|
||||||
|
#if defined(_WIN32) || defined(__CYGWIN__)
|
||||||
|
#define realpath(filename,unused) _fullpath(NULL, filename, 0)
|
||||||
|
#define SEP '\\'
|
||||||
|
#else
|
||||||
|
#define SEP '/'
|
||||||
|
#endif
|
||||||
|
|
||||||
void
|
void
|
||||||
detect(FILE *fp, char **charset, char **lang)
|
detect(FILE *fp, char **charset, char **lang)
|
||||||
{
|
{
|
||||||
@ -116,13 +123,13 @@ main(int argc, char ** argv)
|
|||||||
|
|
||||||
path = realpath(filename, NULL);
|
path = realpath(filename, NULL);
|
||||||
assert(path);
|
assert(path);
|
||||||
expected_charset = strrchr(path, '/');
|
expected_charset = strrchr(path, SEP);
|
||||||
assert(expected_charset);
|
assert(expected_charset);
|
||||||
*expected_charset = '\0';
|
*expected_charset = '\0';
|
||||||
expected_charset++;
|
expected_charset++;
|
||||||
expected_charset = strtok(expected_charset, ".");
|
expected_charset = strtok(expected_charset, ".");
|
||||||
|
|
||||||
expected_lang = strrchr(path, '/');
|
expected_lang = strrchr(path, SEP);
|
||||||
assert(expected_lang);
|
assert(expected_lang);
|
||||||
expected_lang++;
|
expected_lang++;
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user