mirror of
https://github.com/etlegacy/Update-Installer.git
synced 2024-11-29 15:11:48 +00:00
Implement Unix version of dirname()
This commit is contained in:
parent
8fea6c4202
commit
fec68e523b
1 changed files with 8 additions and 1 deletions
|
@ -3,6 +3,9 @@
|
||||||
#include "Platform.h"
|
#include "Platform.h"
|
||||||
#include "StringUtils.h"
|
#include "StringUtils.h"
|
||||||
|
|
||||||
|
#include <malloc.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#ifdef PLATFORM_UNIX
|
#ifdef PLATFORM_UNIX
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -10,6 +13,7 @@
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <libgen.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
FileOps::IOException::~IOException() throw ()
|
FileOps::IOException::~IOException() throw ()
|
||||||
|
@ -125,7 +129,10 @@ void FileOps::removeFile(const char* src) throw (IOException)
|
||||||
std::string FileOps::dirname(const char* path)
|
std::string FileOps::dirname(const char* path)
|
||||||
{
|
{
|
||||||
#ifdef PLATFORM_UNIX
|
#ifdef PLATFORM_UNIX
|
||||||
throw IOException("not implemented");
|
char* pathCopy = strdup(path);
|
||||||
|
std::string dirname = ::dirname(pathCopy);
|
||||||
|
free(pathCopy);
|
||||||
|
return dirname;
|
||||||
#else
|
#else
|
||||||
throw IOException("not implemented");
|
throw IOException("not implemented");
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue