Permalink
Browse files

Merge pull request #4984 from Karlson2k/win32file_01

[win32] Implement new Win32File
  • Loading branch information...
2 parents 7f17034 + 82787d6 commit d3f48dd9128debf6a3b5b1749292ef19cdc37bbf @jmarshallnz jmarshallnz committed Sep 3, 2014
@@ -300,7 +300,6 @@
<ClCompile Include="..\..\xbmc\filesystem\FileReaderFile.cpp" />
<ClCompile Include="..\..\xbmc\filesystem\FTPDirectory.cpp" />
<ClCompile Include="..\..\xbmc\filesystem\FTPParse.cpp" />
- <ClCompile Include="..\..\xbmc\filesystem\HDFile.cpp" />
<ClCompile Include="..\..\xbmc\filesystem\HDHomeRunDirectory.cpp" />
<ClCompile Include="..\..\xbmc\filesystem\HDHomeRunFile.cpp" />
<ClCompile Include="..\..\xbmc\filesystem\HTSPDirectory.cpp" />
@@ -388,6 +387,7 @@
<ClCompile Include="..\..\xbmc\filesystem\VideoDatabaseDirectory\DirectoryNodeGrouped.cpp" />
<ClCompile Include="..\..\xbmc\filesystem\win32\Win32Directory.cpp" />
<ClCompile Include="..\..\xbmc\filesystem\win32\Win32SMBDirectory.cpp" />
+ <ClCompile Include="..\..\xbmc\filesystem\win32\Win32File.cpp" />
<ClCompile Include="..\..\xbmc\filesystem\windows\WINFileSMB.cpp" />
<ClCompile Include="..\..\xbmc\filesystem\windows\WINSMBDirectory.cpp" />
<ClCompile Include="..\..\xbmc\filesystem\VirtualDirectory.cpp" />
@@ -856,6 +856,7 @@
<ClInclude Include="..\..\xbmc\filesystem\VideoDatabaseDirectory\DirectoryNodeGrouped.h" />
<ClInclude Include="..\..\xbmc\filesystem\win32\Win32Directory.h" />
<ClInclude Include="..\..\xbmc\filesystem\win32\Win32SMBDirectory.h" />
+ <ClInclude Include="..\..\xbmc\filesystem\win32\Win32File.h" />
<ClInclude Include="..\..\xbmc\filesystem\windows\WINFileSMB.h" />
<ClInclude Include="..\..\xbmc\filesystem\windows\WINSMBDirectory.h" />
<ClInclude Include="..\..\xbmc\guilib\cximage.h" />
@@ -1043,7 +1044,6 @@
<ClInclude Include="..\..\xbmc\filesystem\FileReaderFile.h" />
<ClInclude Include="..\..\xbmc\filesystem\FTPDirectory.h" />
<ClInclude Include="..\..\xbmc\filesystem\FTPParse.h" />
- <ClInclude Include="..\..\xbmc\filesystem\HDFile.h" />
<ClInclude Include="..\..\xbmc\filesystem\HDHomeRunDirectory.h" />
<ClInclude Include="..\..\xbmc\filesystem\HDHomeRunFile.h" />
<ClInclude Include="..\..\xbmc\filesystem\HTSPDirectory.h" />
@@ -2035,9 +2035,6 @@
<ClCompile Include="..\..\xbmc\filesystem\FTPParse.cpp">
<Filter>filesystem</Filter>
</ClCompile>
- <ClCompile Include="..\..\xbmc\filesystem\HDFile.cpp">
- <Filter>filesystem</Filter>
- </ClCompile>
<ClCompile Include="..\..\xbmc\filesystem\HDHomeRunDirectory.cpp">
<Filter>filesystem</Filter>
</ClCompile>
@@ -3071,6 +3068,9 @@
<ClCompile Include="..\..\xbmc\utils\win32\Win32Log.cpp">
<Filter>utils\win32</Filter>
</ClCompile>
+ <ClCompile Include="..\..\xbmc\filesystem\win32\Win32File.cpp">
+ <Filter>filesystem\win32</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\xbmc\win32\pch.h">
@@ -4987,9 +4987,6 @@
<ClInclude Include="..\..\xbmc\filesystem\FTPParse.h">
<Filter>filesystem</Filter>
</ClInclude>
- <ClInclude Include="..\..\xbmc\filesystem\HDFile.h">
- <Filter>filesystem</Filter>
- </ClInclude>
<ClInclude Include="..\..\xbmc\filesystem\HDHomeRunDirectory.h">
<Filter>filesystem</Filter>
</ClInclude>
@@ -6001,6 +5998,9 @@
<ClInclude Include="..\..\xbmc\utils\win32\Win32Log.h">
<Filter>utils\win32</Filter>
</ClInclude>
+ <ClInclude Include="..\..\xbmc\filesystem\win32\Win32File.h">
+ <Filter>filesystem\win32</Filter>
+ </ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\..\xbmc\win32\XBMC_PC.rc">
View
@@ -119,14 +119,49 @@ class CFile
// CURL interface
static bool Exists(const CURL& file, bool bUseCache = true);
static bool Delete(const CURL& file);
+ /**
+ * Fills struct __stat64 with information about file specified by filename
+ * For st_mode function will set correctly _S_IFDIR (directory) flag and may set
+ * _S_IREAD (read permission), _S_IWRITE (write permission) flags if such
+ * information is available. Function may set st_size (file size), st_atime,
+ * st_mtime, st_ctime (access, modification, creation times).
+ * Any other flags and members of __stat64 that didn't updated with actual file
+ * information will be set to zero (st_nlink can be set ether to 1 or zero).
+ * @param file specifies requested file
+ * @param buffer pointer to __stat64 buffer to receive information about file
+ * @return zero of success, -1 otherwise.
+ */
static int Stat(const CURL& file, struct __stat64* buffer);
static bool Rename(const CURL& file, const CURL& urlNew);
static bool Copy(const CURL& file, const CURL& dest, XFILE::IFileCallback* pCallback = NULL, void* pContext = NULL);
static bool SetHidden(const CURL& file, bool hidden);
// string interface
static bool Exists(const std::string& strFileName, bool bUseCache = true);
+ /**
+ * Fills struct __stat64 with information about file specified by filename
+ * For st_mode function will set correctly _S_IFDIR (directory) flag and may set
+ * _S_IREAD (read permission), _S_IWRITE (write permission) flags if such
+ * information is available. Function may set st_size (file size), st_atime,
+ * st_mtime, st_ctime (access, modification, creation times).
+ * Any other flags and members of __stat64 that didn't updated with actual file
+ * information will be set to zero (st_nlink can be set ether to 1 or zero).
+ * @param strFileName specifies requested file
+ * @param buffer pointer to __stat64 buffer to receive information about file
+ * @return zero of success, -1 otherwise.
+ */
static int Stat(const std::string& strFileName, struct __stat64* buffer);
+ /**
+ * Fills struct __stat64 with information about currently open file
+ * For st_mode function will set correctly _S_IFDIR (directory) flag and may set
+ * _S_IREAD (read permission), _S_IWRITE (write permission) flags if such
+ * information is available. Function may set st_size (file size), st_atime,
+ * st_mtime, st_ctime (access, modification, creation times).
+ * Any other flags and members of __stat64 that didn't updated with actual file
+ * information will be set to zero (st_nlink can be set ether to 1 or zero).
+ * @param buffer pointer to __stat64 buffer to receive information about file
+ * @return zero of success, -1 otherwise.
+ */
int Stat(struct __stat64 *buffer);
static bool Delete(const std::string& strFileName);
static bool Rename(const std::string& strFileName, const std::string& strNewFileName);
@@ -24,7 +24,11 @@
#include "network/Network.h"
#include "system.h"
#include "FileFactory.h"
+#ifdef TARGET_WINDOWS
+#include "win32/Win32File.h"
+#else // ! TARGET_WINDOWS
#include "HDFile.h"
+#endif // ! TARGET_WINDOWS
#include "CurlFile.h"
#include "HTTPFile.h"
#include "DAVFile.h"
@@ -135,7 +139,11 @@ IFile* CFileFactory::CreateLoader(const CURL& url)
else if (url.IsProtocol("special")) return new CSpecialProtocolFile();
else if (url.IsProtocol("multipath")) return new CMultiPathFile();
else if (url.IsProtocol("image")) return new CImageFile();
+#ifdef TARGET_WINDOWS
+ else if (url.IsProtocol("file") || url.GetProtocol().empty()) return new CWin32File();
+#else // ! TARGET_WINDOWS
else if (url.IsProtocol("file") || url.GetProtocol().empty()) return new CHDFile();
+#endif // ! TARGET_WINDOWS
else if (url.IsProtocol("filereader")) return new CFileReaderFile();
#if defined(HAS_FILESYSTEM_CDDA) && defined(HAS_DVD_DRIVE)
else if (url.IsProtocol("cdda")) return new CFileCDDA();
View
@@ -54,7 +54,30 @@ class IFile
virtual bool Open(const CURL& url) = 0;
virtual bool OpenForWrite(const CURL& url, bool bOverWrite = false) { return false; };
virtual bool Exists(const CURL& url) = 0;
+ /**
+ * Fills struct __stat64 with information about file specified by url.
+ * For st_mode function will set correctly _S_IFDIR (directory) flag and may set
+ * _S_IREAD (read permission), _S_IWRITE (write permission) flags if such
+ * information is available. Function may set st_size (file size), st_atime,
+ * st_mtime, st_ctime (access, modification, creation times).
+ * Any other flags and members of __stat64 that didn't updated with actual file
+ * information will be set to zero (st_nlink can be set ether to 1 or zero).
+ * @param url specifies requested file
+ * @param buffer pointer to __stat64 buffer to receive information about file
+ * @return zero of success, -1 otherwise.
+ */
virtual int Stat(const CURL& url, struct __stat64* buffer) = 0;
+ /**
+ * Fills struct __stat64 with information about currently open file
+ * For st_mode function will set correctly _S_IFDIR (directory) flag and may set
+ * _S_IREAD (read permission), _S_IWRITE (write permission) flags if such
+ * information is available. Function may set st_size (file size), st_atime,
+ * st_mtime, st_ctime (access, modification, creation times).
+ * Any other flags and members of __stat64 that didn't updated with actual file
+ * information will be set to zero (st_nlink can be set ether to 1 or zero).
+ * @param buffer pointer to __stat64 buffer to receive information about file
+ * @return zero of success, -1 otherwise.
+ */
virtual int Stat(struct __stat64* buffer);
virtual unsigned int Read(void* lpBuf, int64_t uiBufSize) = 0;
virtual int Write(const void* lpBuf, int64_t uiBufSize) { return -1;};
Oops, something went wrong.

0 comments on commit d3f48dd

Please sign in to comment.