mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
move VCMIDirs::genHelpString() implementation to the base class
removes copy-paste
This commit is contained in:
parent
e4ac0d4370
commit
03b4ea71ba
@ -20,6 +20,24 @@ bfs::path IVCMIDirs::fullLibraryPath(const std::string &desiredFolder, const std
|
||||
return libraryPath() / desiredFolder / libraryName(baseLibName);
|
||||
}
|
||||
|
||||
std::string IVCMIDirs::genHelpString() const
|
||||
{
|
||||
std::vector<std::string> tempVec;
|
||||
for (const bfs::path & path : dataPaths())
|
||||
tempVec.push_back(path.string());
|
||||
const auto gdStringA = boost::algorithm::join(tempVec, ":");
|
||||
|
||||
return
|
||||
" game data: " + gdStringA + "\n"
|
||||
" libraries: " + libraryPath().string() + "\n"
|
||||
" server: " + serverPath().string() + "\n"
|
||||
"\n"
|
||||
" user data: " + userDataPath().string() + "\n"
|
||||
" user cache: " + userCachePath().string() + "\n"
|
||||
" user config: " + userConfigPath().string() + "\n"
|
||||
" user saves: " + userSavePath().string() + "\n"; // Should end without new-line?
|
||||
}
|
||||
|
||||
void IVCMIDirs::init()
|
||||
{
|
||||
// TODO: Log errors
|
||||
@ -134,8 +152,6 @@ class VCMIDirsWIN32 final : public IVCMIDirs
|
||||
|
||||
std::string libraryName(const std::string& basename) const override;
|
||||
|
||||
std::string genHelpString() const override;
|
||||
|
||||
void init() override;
|
||||
protected:
|
||||
boost::filesystem::path oldUserDataPath() const;
|
||||
@ -321,26 +337,6 @@ bfs::path VCMIDirsWIN32::serverPath() const { return binaryPath() / "VCMI_server
|
||||
bfs::path VCMIDirsWIN32::libraryPath() const { return "."; }
|
||||
bfs::path VCMIDirsWIN32::binaryPath() const { return "."; }
|
||||
|
||||
std::string VCMIDirsWIN32::genHelpString() const
|
||||
{
|
||||
|
||||
std::vector<std::string> tempVec;
|
||||
for (const bfs::path& path : dataPaths())
|
||||
tempVec.push_back(path.string());
|
||||
std::string gdStringA = boost::algorithm::join(tempVec, ";");
|
||||
|
||||
|
||||
return
|
||||
" game data: " + gdStringA + "\n"
|
||||
" libraries: " + libraryPath().string() + "\n"
|
||||
" server: " + serverPath().string() + "\n"
|
||||
"\n"
|
||||
" user data: " + userDataPath().string() + "\n"
|
||||
" user cache: " + userCachePath().string() + "\n"
|
||||
" user config: " + userConfigPath().string() + "\n"
|
||||
" user saves: " + userSavePath().string() + "\n"; // Should end without new-line?
|
||||
}
|
||||
|
||||
std::string VCMIDirsWIN32::libraryName(const std::string& basename) const { return basename + ".dll"; }
|
||||
#elif defined(VCMI_UNIX)
|
||||
class IVCMIDirsUNIX : public IVCMIDirs
|
||||
@ -349,8 +345,6 @@ class IVCMIDirsUNIX : public IVCMIDirs
|
||||
boost::filesystem::path clientPath() const override;
|
||||
boost::filesystem::path serverPath() const override;
|
||||
|
||||
std::string genHelpString() const override;
|
||||
|
||||
bool developmentMode() const;
|
||||
};
|
||||
|
||||
@ -363,25 +357,6 @@ bool IVCMIDirsUNIX::developmentMode() const
|
||||
bfs::path IVCMIDirsUNIX::clientPath() const { return binaryPath() / "vcmiclient"; }
|
||||
bfs::path IVCMIDirsUNIX::serverPath() const { return binaryPath() / "vcmiserver"; }
|
||||
|
||||
std::string IVCMIDirsUNIX::genHelpString() const
|
||||
{
|
||||
std::vector<std::string> tempVec;
|
||||
for (const bfs::path& path : dataPaths())
|
||||
tempVec.push_back(path.string());
|
||||
std::string gdStringA = boost::algorithm::join(tempVec, ":");
|
||||
|
||||
|
||||
return
|
||||
" game data: " + gdStringA + "\n"
|
||||
" libraries: " + libraryPath().string() + "\n"
|
||||
" server: " + serverPath().string() + "\n"
|
||||
"\n"
|
||||
" user data: " + userDataPath().string() + "\n"
|
||||
" user cache: " + userCachePath().string() + "\n"
|
||||
" user config: " + userConfigPath().string() + "\n"
|
||||
" user saves: " + userSavePath().string() + "\n"; // Should end without new-line?
|
||||
}
|
||||
|
||||
#ifdef VCMI_APPLE
|
||||
class VCMIDirsOSX final : public IVCMIDirsUNIX
|
||||
{
|
||||
|
@ -49,7 +49,7 @@ public:
|
||||
// virtual std::string libraryName(const char* basename) const = 0; ?
|
||||
// virtual std::string libraryName(std::string&& basename) const = 0;?
|
||||
|
||||
virtual std::string genHelpString() const = 0;
|
||||
virtual std::string genHelpString() const;
|
||||
|
||||
// Creates not existed, but required directories.
|
||||
// Updates directories what change name/path between versions.
|
||||
|
Loading…
Reference in New Issue
Block a user