Explorar o código

Fixing a few invalid params

BearishSun %!s(int64=9) %!d(string=hai) anos
pai
achega
079f576f1d
Modificáronse 1 ficheiros con 29 adicións e 31 borrados
  1. 29 31
      Source/BansheeUtility/Source/Win32/BsWin32FileSystem.cpp

+ 29 - 31
Source/BansheeUtility/Source/Win32/BsWin32FileSystem.cpp

@@ -200,7 +200,6 @@ namespace BansheeEngine
 		return false;
 	}
 
-
 	bool win32_createDirectory(const WString& path)
 	{
 		if (win32_pathExists(path) && win32_isDirectory(path))
@@ -212,6 +211,31 @@ namespace BansheeEngine
 		return true;
 	}
 
+	UINT64 win32_getFileSize(const WString& path)
+	{
+		WIN32_FILE_ATTRIBUTE_DATA attrData;
+		if (GetFileAttributesExW(path.c_str(), GetFileExInfoStandard, &attrData) == FALSE)
+			win32_handleError(GetLastError(), path);
+
+		LARGE_INTEGER li;
+		li.LowPart = attrData.nFileSizeLow;
+		li.HighPart = attrData.nFileSizeHigh;
+		return (UINT64)li.QuadPart;
+	}
+
+	std::time_t win32_getLastModifiedTime(const WString& path)
+	{
+		WIN32_FILE_ATTRIBUTE_DATA fad;
+		if (GetFileAttributesExW(path.c_str(), GetFileExInfoStandard, &fad) == 0)
+			win32_handleError(GetLastError(), path);
+
+		ULARGE_INTEGER ull;
+		ull.LowPart = fad.ftLastWriteTime.dwLowDateTime;
+		ull.HighPart = fad.ftLastWriteTime.dwHighDateTime;
+
+		return (std::time_t) ((ull.QuadPart / 10000000ULL) - 11644473600ULL);
+	}
+
 	void FileSystem::removeFile(const Path& path)
 	{
 		WString pathStr = path.toWString();
@@ -230,40 +254,15 @@ namespace BansheeEngine
 	void FileSystem::copyFile(const Path& from, const Path& to)
 	{
 		if (CopyFileW(from.toWString().c_str(), to.toWString().c_str(), FALSE) == FALSE)
-			win32_handleError(GetLastError(), from);
+			win32_handleError(GetLastError(), from.toWString());
 	}
 
 	void FileSystem::moveFile(const Path& oldPath, const Path& newPath)
 	{
 		WString oldPathStr = oldPath.toWString();
 		WString newPathStr = newPath.toWString();
-		if (MoveFileW(oldPath.c_str(), newPath.c_str()) == 0)
-			win32_handleError(GetLastError(), oldPath);
-	}
-
-	UINT64 win32_getFileSize(const WString& path)
-	{
-		WIN32_FILE_ATTRIBUTE_DATA attrData;
-		if (GetFileAttributesExW(path.c_str(), GetFileExInfoStandard, &attrData) == FALSE)
-			win32_handleError(GetLastError(), path);
-
-		LARGE_INTEGER li;
-		li.LowPart = attrData.nFileSizeLow;
-		li.HighPart = attrData.nFileSizeHigh;
-		return (UINT64)li.QuadPart;
-	}
-
-	std::time_t win32_getLastModifiedTime(const WString& path)
-	{
-		WIN32_FILE_ATTRIBUTE_DATA fad;
-		if (GetFileAttributesExW(path.c_str(), GetFileExInfoStandard, &fad) == 0)
-			win32_handleError(GetLastError(), path);
-
-		ULARGE_INTEGER ull;
-		ull.LowPart = fad.ftLastWriteTime.dwLowDateTime;
-		ull.HighPart = fad.ftLastWriteTime.dwHighDateTime;
-
-		return (std::time_t) ((ull.QuadPart / 10000000ULL) - 11644473600ULL);
+		if (MoveFileW(oldPathStr.c_str(), newPathStr.c_str()) == 0)
+			win32_handleError(GetLastError(), oldPathStr);
 	}
 
 	SPtr<DataStream> FileSystem::openFile(const Path& fullPath, bool readOnly)
@@ -296,7 +295,6 @@ namespace BansheeEngine
 
 	void FileSystem::move(const Path& oldPath, const Path& newPath, bool overwriteExisting)
 	{
-		WString oldPathStr = oldPath.toWString();
 		WString newPathStr = newPath.toWString();
 
 		if (win32_pathExists(newPathStr))
@@ -310,7 +308,7 @@ namespace BansheeEngine
 			}
 		}
 
-		win32_rename(oldPathStr, newPathStr);
+		moveFile(oldPath, newPath);
 	}
 
 	bool FileSystem::exists(const Path& fullPath)