Skip to content

Commit

Permalink
Merge branch 'vanilla' into fixes/boulders
Browse files Browse the repository at this point in the history
  • Loading branch information
giulianobelinassi authored Jun 25, 2024
2 parents 751ecbe + 19073d6 commit efcc007
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
7 changes: 5 additions & 2 deletions common/file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@ static void Resolve_File_Single(char* fname)
return;
}

if (ffblk->FindFirst(fname) && strlen(fname) == strlen(ffblk->GetName())) {
strncpy(fname, ffblk->GetName(), strlen(fname) + 1);
size_t name_len = strlen(fname);
size_t full_len = strlen(ffblk->GetFullName());

if (ffblk->FindFirst(fname) && name_len == full_len) {
strncpy(fname, ffblk->GetFullName(), name_len + 1);
}

delete ffblk;
Expand Down
4 changes: 4 additions & 0 deletions common/file.h
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,10 @@ class Find_File_Data
{
}
virtual const char* GetName() const = 0;
virtual const char* GetFullName() const
{
return nullptr;
};
virtual unsigned int GetTime() const = 0;

virtual bool FindFirst(const char* fname) = 0;
Expand Down
6 changes: 5 additions & 1 deletion common/file_posix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ class Find_File_Data_Posix : public Find_File_Data
virtual ~Find_File_Data_Posix();

virtual const char* GetName() const;
virtual const char* GetFullName() const
{
return DirEntry != nullptr ? FullName : nullptr;
}
virtual unsigned int GetTime() const;

virtual bool FindFirst(const char* fname);
Expand Down Expand Up @@ -50,7 +54,7 @@ const char* Find_File_Data_Posix::GetName() const
if (DirEntry == nullptr) {
return nullptr;
}
return FullName;
return DirEntry->d_name;
}

unsigned int Find_File_Data_Posix::GetTime() const
Expand Down

0 comments on commit efcc007

Please sign in to comment.