Skip to content

Commit

Permalink
Removed the function GetExtensionFromRelPath()
Browse files Browse the repository at this point in the history
  • Loading branch information
mikekazakov committed Dec 19, 2024
1 parent 5a49953 commit a7e5f05
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 33 deletions.
6 changes: 0 additions & 6 deletions Source/Utility/include/Utility/PathManip.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,6 @@ bool GetDirectoryContainingItemFromRelPath(const char *_path, char *_buf);
*/
bool GetExtensionFromPath(const char *_path, char *_buf);

/**
* GetExtensionFromRelPath can work with absolute path and paths like "filename.txt"
* It will not extract extensions from filenames like ".filename" or "filename."
*/
bool GetExtensionFromRelPath(const char *_path, char *_buf);

// prefer PathManip::EnsureTrailingSlash() instead, semantically equal
inline std::string EnsureTrailingSlash(std::string _s)
{
Expand Down
27 changes: 0 additions & 27 deletions Source/Utility/source/PathManip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,33 +64,6 @@ bool GetExtensionFromPath(const char *_path, char *_buf)
return true;
}

bool GetExtensionFromRelPath(const char *_path, char *_buf)
{
const char *last_sl = strrchr(_path, '/');
const char *last_dot = strrchr(_path, '.');
if( last_dot == nullptr )
return false;

if( last_sl ) {
if( last_dot == last_sl + 1 )
return false;
if( last_dot == _path + strlen(_path) - 1 )
return false;
if( last_dot < last_sl )
return false;
strcpy(_buf, last_dot + 1);
return true;
}
else {
if( last_dot == _path )
return false;
if( last_dot == _path + strlen(_path) - 1 )
return false;
strcpy(_buf, last_dot + 1);
return true;
}
}

bool GetDirectoryNameFromPath(const char *_path, char *_dir_out, [[maybe_unused]] size_t _dir_size)
{
const char *second_sep = strrchr(_path, '/');
Expand Down

0 comments on commit a7e5f05

Please sign in to comment.