main.cpp: make dir divider platform agnostic
This commit is contained in:
parent
30c34d7ccb
commit
18cce3958d
6
main.cpp
6
main.cpp
@ -12,6 +12,8 @@
|
|||||||
using char_t = wchar_t;
|
using char_t = wchar_t;
|
||||||
using string = std::wstring;
|
using string = std::wstring;
|
||||||
|
|
||||||
|
constexpr const char_t *dir_divider = L"\\";
|
||||||
|
|
||||||
#define cerr std::wcerr
|
#define cerr std::wcerr
|
||||||
#define cout std::wcout
|
#define cout std::wcout
|
||||||
#define cin std::wcin
|
#define cin std::wcin
|
||||||
@ -26,6 +28,8 @@ using string = std::wstring;
|
|||||||
using char_t = char;
|
using char_t = char;
|
||||||
using string = std::string;
|
using string = std::string;
|
||||||
|
|
||||||
|
constexpr const char_t *dir_divider = "/";
|
||||||
|
|
||||||
#define cerr std::cerr
|
#define cerr std::cerr
|
||||||
#define cout std::cout
|
#define cout std::cout
|
||||||
#define cin std::cin
|
#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 ) {
|
void ensureShowNotEmpty( string &show, const string &path ) {
|
||||||
if ( show.empty() ) {
|
if ( show.empty() ) {
|
||||||
show = FSLib::canonical( path );
|
show = FSLib::canonical( path );
|
||||||
auto pos = show.find_last_of( '/' );
|
auto pos = show.find_last_of( dir_divider );
|
||||||
if ( pos != string::npos )
|
if ( pos != string::npos )
|
||||||
show = show.substr( ++pos );
|
show = show.substr( ++pos );
|
||||||
cout << _( SHOW_CONFIRM ) << ' ' << show << std::endl;
|
cout << _( SHOW_CONFIRM ) << ' ' << show << std::endl;
|
||||||
|
Loading…
Reference in New Issue
Block a user