Skip to content
Snippets Groups Projects
Commit 57dbf954 authored by Ivan Dokunov's avatar Ivan Dokunov
Browse files

Merge branch 'Fix' into 'branchX'

Fix

See merge request !5
parents a249675e 907da700
Branches
Tags
1 merge request!5Fix
......@@ -4,8 +4,8 @@ lighting_blend.ps
Расчет освещения и заполнение данными расчетов render targets
*/
#include <../struct.h>
#include <../mtrl.h>
#include "../struct.h"
#include "../mtrl.h"
//##########################################################################
......
......@@ -93,7 +93,7 @@ char *CFileSystem::getFileName(const char *name)
return fn;
}
time_t CFileSystem::convertFiletimeToTime_t(const FILETIME& ft)
time_t CFileSystem::filetimeToTime_t(const FILETIME& ft)
{
ULARGE_INTEGER ull;
ull.LowPart = ft.dwLowDateTime;
......@@ -234,17 +234,18 @@ bool CFileSystem::fileExists(const char *szPath)
return false;
}
HANDLE hFile = getFileHandle(path);
CLOSE_HANDLE(hFile);
mem_delete_a(path);
//Если файл существует то hFile != INVALID_HANDLE_VALUE
return hFile != INVALID_HANDLE_VALUE;
return fileGetSize(path) != -1;
}
size_t CFileSystem::fileGetSize(const char *szPath)
{
char* path = getAbsoliteCanonizePath(szPath);
if (!path)
{
return false;
}
WIN32_FILE_ATTRIBUTE_DATA lpFileInformation;
int result = GetFileAttributesEx(szPath, GetFileExInfoStandard, &lpFileInformation);
......@@ -254,6 +255,8 @@ size_t CFileSystem::fileGetSize(const char *szPath)
sizeof(lpFileInformation.nFileSizeLow) * sizeof(ULONGLONG)) |
lpFileInformation.nFileSizeLow;
mem_delete_a(path);
//Если result != 0 то все хорошо, если 0 то файл не найден
return result != 0 ? FileSize : FILE_NOT_FOUND;
}
......@@ -301,17 +304,13 @@ time_t CFileSystem::getFileModifyTime(const char *szPath)
return 0;
}
FILETIME mTime;
HANDLE hFile = getFileHandle(path);
mem_delete_a(path);
WIN32_FILE_ATTRIBUTE_DATA lpFileInformation;
GetFileTime(hFile, nullptr, &mTime, nullptr);
GetFileAttributesEx(path, GetFileExInfoStandard, &lpFileInformation);
CLOSE_HANDLE(hFile);
mem_delete(path);
return convertFiletimeToTime_t(mTime);
return filetimeToTime_t(lpFileInformation.ftLastAccessTime);
}
IFileSystem::IFileIterator *CFileSystem::getFolderList(const char *szPath)
......
......@@ -90,7 +90,7 @@ private:
char *getFileName(const char *name);
//! Вспомогательная функция для конвертирования FILETIME в time_t
time_t convertFiletimeToTime_t(const FILETIME& ft);
time_t filetimeToTime_t(const FILETIME& ft);
HANDLE getFileHandle(const char *szPath);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment