Skip to content

Commit

Permalink
Cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
bkaradzic committed Nov 17, 2017
1 parent 0c1354a commit 451e30b
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 23 deletions.
3 changes: 0 additions & 3 deletions include/bx/os.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,6 @@ namespace bx
///
int chdir(const char* _path);

///
char* pwd(char* _buffer, uint32_t _size);

///
void* exec(const char* const* _argv);

Expand Down
20 changes: 20 additions & 0 deletions src/filepath.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@
#include <bx/os.h>
#include <bx/readerwriter.h>

#if BX_CRT_MSVC
# include <direct.h> // _getcwd
#else
# include <unistd.h> // getcwd
#endif // BX_CRT_MSVC

#if BX_PLATFORM_WINDOWS
extern "C" __declspec(dllimport) unsigned long __stdcall GetTempPathA(unsigned long _max, char* _ptr);
#endif // BX_PLATFORM_WINDOWS
Expand Down Expand Up @@ -161,6 +167,20 @@ namespace bx
return false;
}

static char* pwd(char* _buffer, uint32_t _size)
{
#if BX_PLATFORM_PS4 \
|| BX_PLATFORM_XBOXONE \
|| BX_PLATFORM_WINRT
BX_UNUSED(_buffer, _size);
return NULL;
#elif BX_CRT_MSVC
return ::_getcwd(_buffer, (int)_size);
#else
return ::getcwd(_buffer, _size);
#endif // BX_COMPILER_
}

static bool getCurrentPath(char* _out, uint32_t* _inOutSize)
{
uint32_t len = *_inOutSize;
Expand Down
20 changes: 0 additions & 20 deletions src/os.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,6 @@
# endif // BX_PLATFORM_ANDROID
#endif // BX_PLATFORM_

#if BX_CRT_MSVC
# include <direct.h> // _getcwd
#else
# include <unistd.h> // getcwd
#endif // BX_CRT_MSVC

namespace bx
{

Expand Down Expand Up @@ -287,20 +281,6 @@ namespace bx
#endif // BX_COMPILER_
}

char* pwd(char* _buffer, uint32_t _size)
{
#if BX_PLATFORM_PS4 \
|| BX_PLATFORM_XBOXONE \
|| BX_PLATFORM_WINRT
BX_UNUSED(_buffer, _size);
return NULL;
#elif BX_CRT_MSVC
return ::_getcwd(_buffer, (int)_size);
#else
return ::getcwd(_buffer, _size);
#endif // BX_COMPILER_
}

void* exec(const char* const* _argv)
{
#if BX_PLATFORM_LINUX \
Expand Down

1 comment on commit 451e30b

@mmicko
Copy link
Contributor

@mmicko mmicko commented on 451e30b Nov 18, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For fixing windows builds (mingw and vs) just add in os.cpp at line 18: # include <direct.h>

Please sign in to comment.