Skip to content

Commit

Permalink
Replace path_get_filename_start with os::getFilename
Browse files Browse the repository at this point in the history
  • Loading branch information
codereader committed Jan 29, 2017
1 parent 2ab4d29 commit 87fb451
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 26 deletions.
24 changes: 0 additions & 24 deletions libs/os/path.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,30 +113,6 @@ inline const char* path_remove_directory(const char* path)
return "";
}

/// \brief Returns a pointer to the first character of the filename component of \p path.
/// O(n)
inline const char* path_get_filename_start(const char* path)
{
{
const char* last_forward_slash = strrchr(path, '/');
if(last_forward_slash != 0)
{
return last_forward_slash + 1;
}
}

// not strictly necessary,since paths should not contain '\'
{
const char* last_backward_slash = strrchr(path, '\\');
if(last_backward_slash != 0)
{
return last_backward_slash + 1;
}
}

return path;
}

/** General utility functions for OS-related tasks
*/
namespace os
Expand Down
4 changes: 2 additions & 2 deletions radiant/map/Map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@ bool Map::saveDirect(const std::string& filename, const MapFormatPtr& mapFormat)
if (_saveInProgress) return false; // safeguard

// Disable screen updates for the scope of this function
ui::ScreenUpdateBlocker blocker(_("Processing..."), path_get_filename_start(filename.c_str()));
ui::ScreenUpdateBlocker blocker(_("Processing..."), os::getFilename(filename));

_saveInProgress = true;

Expand Down Expand Up @@ -553,7 +553,7 @@ bool Map::saveSelected(const std::string& filename, const MapFormatPtr& mapForma
if (_saveInProgress) return false; // safeguard

// Disable screen updates for the scope of this function
ui::ScreenUpdateBlocker blocker(_("Processing..."), path_get_filename_start(filename.c_str()));
ui::ScreenUpdateBlocker blocker(_("Processing..."), os::getFilename(filename));

_saveInProgress = true;

Expand Down

0 comments on commit 87fb451

Please sign in to comment.