Skip to content

Commit

Permalink
Attempt to fix compile on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
garbear committed Jun 23, 2015
1 parent 4d25173 commit ee5ad0e
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 10 deletions.
22 changes: 14 additions & 8 deletions src/filesystem/IFileUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,20 @@ namespace JOYSTICK
{
struct STAT_STRUCTURE
{
uint32_t deviceId; // ID of device containing file
uint64_t size; // Total size, in bytes
struct timespec accessTime; // Time of last access
struct timespec modificationTime; // Time of last modification
struct timespec statusTime; // Time of last status change
bool isDirectory; // The stat url is a directory
bool isSymLink; // The stat url is a symbolic link
bool isHidden; // The file is hidden
uint32_t deviceId; // ID of device containing file
uint64_t size; // Total size, in bytes
#if !defined(_WIN32)
timespec accessTime; // Time of last access
timespec modificationTime; // Time of last modification
timespec statusTime; // Time of last status change
#else
__time64_t accessTime; // Time of last access
__time64_t modificationTime; // Time of last modification
__time64_t statusTime; // Time of last status change
#endif
bool isDirectory; // The stat url is a directory
bool isSymLink; // The stat url is a symbolic link
bool isHidden; // The file is hidden
};

class IFileUtils
Expand Down
18 changes: 16 additions & 2 deletions src/filesystem/vfs/VFSFileUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@
*/

// This must be #defined before libXBMC_addon.h to fix compile
#include <sys/stat.h>
#define __stat64 stat64
#if !defined(_WIN32)
#include <sys/stat.h>
#define __stat64 stat64
#endif

#include "VFSFileUtils.h"

Expand All @@ -30,6 +32,14 @@

using namespace JOYSTICK;

#ifndef S_ISDIR
#define S_ISDIR(mode) ((((mode)) & 0170000) == (0040000))
#endif

#ifndef S_ISLNK
#define S_ISLNK(mode) ((((mode)) & 0170000) == (0120000))
#endif

CVFSFileUtils::CVFSFileUtils(ADDON::CHelper_libXBMC_addon* frontend)
: m_frontend(frontend)
{
Expand All @@ -52,6 +62,10 @@ bool CVFSFileUtils::Stat(const std::string& url, STAT_STRUCTURE& buffer)
buffer.accessTime = frontendBuffer.st_atimespec;
buffer.modificationTime = frontendBuffer.st_mtimespec;
buffer.statusTime = frontendBuffer.st_ctimespec;
#elif defined(_WIN32)
buffer.accessTime = frontendBuffer.st_atime;
buffer.modificationTime = frontendBuffer.st_mtime;
buffer.statusTime = frontendBuffer.st_ctime;
#else
buffer.accessTime = frontendBuffer.st_atim;
buffer.modificationTime = frontendBuffer.st_mtim;
Expand Down

0 comments on commit ee5ad0e

Please sign in to comment.