Skip to content

Commit

Permalink
Crash fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
UnrealKaraulov committed Jan 14, 2025
1 parent 02d7d53 commit 1358e4e
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 10 deletions.
2 changes: 1 addition & 1 deletion DotAAllstarsHelperFinal/DotAAllstarsHelper.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@
<AssemblyDebug>
</AssemblyDebug>
<MinimumRequiredVersion>5.01</MinimumRequiredVersion>
<LargeAddressAware>false</LargeAddressAware>
<LargeAddressAware>true</LargeAddressAware>
<FixedBaseAddress>false</FixedBaseAddress>
<BaseAddress>
</BaseAddress>
Expand Down
3 changes: 2 additions & 1 deletion DotAAllstarsHelperFinal/DotaAllstarsHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@

bool FileExist(const char* name)
{
return std::filesystem::exists(name) && !std::filesystem::is_directory(name);
std::error_code err{};
return fs::exists(name,err) && !fs::is_directory(name,err);
}

bool DEBUG_FULL = false;
Expand Down
6 changes: 4 additions & 2 deletions DotAAllstarsHelperFinal/DotaFilesHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,8 @@ void ApplyIconFilter(std::string filename, unsigned char** OutDataPointer, size_

if (dir.string().length() > 0)
{
fs::create_directories(dir.string());
std::error_code err;
fs::create_directories(dir.string(),err);
}

FILE* f;
Expand Down Expand Up @@ -2071,10 +2072,11 @@ std::vector<std::string> get_file_list(const fs::path& path, bool dotolower)
std::vector<std::string> m_file_list;
if (!path.empty())
{
std::error_code err{};
fs::path apk_path(path);
fs::recursive_directory_iterator end;

for (fs::recursive_directory_iterator i(apk_path); i != end; ++i)
for (fs::recursive_directory_iterator i(apk_path,err); i != end; ++i)
{
const fs::path cp = (*i);

Expand Down
13 changes: 7 additions & 6 deletions DotAAllstarsHelperFinal/DotaWebHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -316,13 +316,13 @@ const char* __stdcall GetLatestDownloadedString(int)
}

//
//std::filesystem::file_time_type GetLastFileTime( const std::vector<std::string> & files )
//fs::file_time_type GetLastFileTime( const std::vector<std::string> & files )
//{
// std::filesystem::file_time_type retval = std::filesystem::file_time_type( );
// fs::file_time_type retval = fs::file_time_type( );
// std::string file = files
// for ( auto s : files )
// {
// auto curfiletime = std::filesystem::last_write_time( s );
// auto curfiletime = fs::last_write_time( s );
// if ( curfiletime > retval )
// {
// retval = curfiletime;
Expand All @@ -335,7 +335,7 @@ bool IsOkayLogFile(std::string file)
{
try
{
if (fs::path(file).extension().string() == ".txt")
if (file.size() && fs::path(file).extension().string() == ".txt")
{
std::string filedata = ToLower(GetFileContent(file));
if (filedata.length() > 0)
Expand All @@ -362,9 +362,10 @@ bool IsOkayLogFile(std::string file)
int __stdcall SendLatestError(const char* url)
{
auto Errors = get_file_list("Errors", true);
std::error_code err{};
std::string sendfilename = "Errors\\lastcheck.txt";
auto LatestError = FileExist(sendfilename.c_str()) ?
std::filesystem::last_write_time(sendfilename) : std::filesystem::file_time_type();
fs::last_write_time(sendfilename, err) : fs::file_time_type();
bool foundlatesterror = false;

if (SetInfoObjDebugVal)
Expand All @@ -388,7 +389,7 @@ int __stdcall SendLatestError(const char* url)
{
PrintText("Process file:" + s);
}
auto curfiletime = std::filesystem::last_write_time(s);
auto curfiletime = fs::last_write_time(s,err);
if (curfiletime > LatestError)
{
if (SetInfoObjDebugVal)
Expand Down

0 comments on commit 1358e4e

Please sign in to comment.