main.cpp: make dir divider platform agnostic

This commit is contained in:
zvon 2020-05-11 15:38:03 +02:00
parent 30c34d7ccb
commit 18cce3958d

View File

@ -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;