From 18cce3958dd41bc1960c639b67dfa0f602c698c6 Mon Sep 17 00:00:00 2001 From: zvon Date: Mon, 11 May 2020 15:38:03 +0200 Subject: [PATCH] main.cpp: make dir divider platform agnostic --- main.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/main.cpp b/main.cpp index 61cebda..1407013 100644 --- a/main.cpp +++ b/main.cpp @@ -12,6 +12,8 @@ using char_t = wchar_t; using string = std::wstring; +constexpr const char_t *dir_divider = L"\\"; + #define cerr std::wcerr #define cout std::wcout #define cin std::wcin @@ -26,6 +28,8 @@ using string = std::wstring; using char_t = char; using string = std::string; +constexpr const char_t *dir_divider = "/"; + #define cerr std::cerr #define cout std::cout #define cin std::cin @@ -249,7 +253,7 @@ int parseCommandLine( string &show, std::set< int > &seasons_num, string &path, void ensureShowNotEmpty( string &show, const string &path ) { if ( show.empty() ) { show = FSLib::canonical( path ); - auto pos = show.find_last_of( '/' ); + auto pos = show.find_last_of( dir_divider ); if ( pos != string::npos ) show = show.substr( ++pos ); cout << _( SHOW_CONFIRM ) << ' ' << show << std::endl;