diff options
Diffstat (limited to 'cpp/demo/IcePatch2/MFC/PatchClientDlg.cpp')
-rwxr-xr-x | cpp/demo/IcePatch2/MFC/PatchClientDlg.cpp | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/cpp/demo/IcePatch2/MFC/PatchClientDlg.cpp b/cpp/demo/IcePatch2/MFC/PatchClientDlg.cpp index 0453190293f..e24bf943af7 100755 --- a/cpp/demo/IcePatch2/MFC/PatchClientDlg.cpp +++ b/cpp/demo/IcePatch2/MFC/PatchClientDlg.cpp @@ -12,7 +12,6 @@ #include "PatchClientDlg.h" #include <IcePatch2/ClientUtil.h> -#include <IcePatch2/Util.h> #ifdef _DEBUG #define new DEBUG_NEW @@ -20,6 +19,25 @@ using namespace std; +string +getBasename(const string& path) +{ + string::size_type pos = path.rfind('/'); + if(pos == string::npos) + { + pos = path.rfind('\\'); + } + + if(pos == string::npos) + { + return path; + } + else + { + return path.substr(pos + 1); + } +} + class DialogPatcherFeedback : public IcePatch2::PatcherFeedback { public: @@ -130,7 +148,7 @@ CPatchDlg::checksumProgress(const string& path) // TODO: indicate busy progress CString file; - file.Format(L" %s", IceUtil::stringToWstring(IcePatch2::getBasename(path)).c_str()); + file.Format(L" %s", IceUtil::stringToWstring(getBasename(path)).c_str()); _file->SetWindowText(file); processMessages(); @@ -188,7 +206,7 @@ CPatchDlg::patchStart(const string& path, Ice::Long size, Ice::Long totalProgres } CString file; - file.Format(L" %s", IceUtil::stringToWstring(IcePatch2::getBasename(path)).c_str()); + file.Format(L" %s", IceUtil::stringToWstring(getBasename(path)).c_str()); _file->SetWindowText(file); return patchProgress(0, size, totalProgress, totalSize); |