windows: Create basename function

This commit is contained in:
Felipe Magno de Almeida 2020-05-04 23:52:13 -03:00
parent d7fa5eab99
commit 3179089b49
6 changed files with 34 additions and 8 deletions

View File

@ -24,7 +24,6 @@
#include <stdio.h>
#include <sys/types.h>
#include <string.h>
#include <libgen.h>
#include <unistd.h>
#if defined HAVE_DLOPEN && ! defined _WIN32
@ -45,6 +44,12 @@
#include "eina_safety_checks.h"
#include "eina_module.h"
#ifndef _MSC_VER
#include <libgen.h>
#else
#include <evil_basename.h>
#endif
/*============================================================================*
* Local *
*============================================================================*/

View File

@ -28,6 +28,8 @@
#include <limits.h>
#include <ctype.h>
#include <strings.h>
#ifdef HAVE_BSD_STRING_H
# include <bsd/string.h>
#endif

View File

@ -0,0 +1,16 @@
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif /* HAVE_CONFIG_H */
#include <evil_api.h>
#include <stdlib.h>
#include <evil_windows.h>
EVIL_API char* basename (char* path)
{
static char base[MAX_PATH];
_splitpath_s (path, NULL, 0, NULL, 0, base, MAX_PATH, NULL, 0);
return base;
}

View File

@ -0,0 +1,9 @@
#ifndef __EVIL_BASENAME_H__
#define __EVIL_BASENAME_H__
#include <evil_api.h>
EVIL_API char* basename (char* path);
#endif

View File

@ -15,6 +15,7 @@ if target_machine.system() == 'windows'
'evil_unistd.c',
'evil_util.c',
'evil_private.h',
'evil_basename.c',
'pcre/regex.h',
]

View File

@ -1,7 +0,0 @@
#ifndef UNPOSIX_LIBGEN_H
#define UNPOSIX_LIBGEN_H
char *basename(char *);
char *dirname(char *);
#endif