Remove unneeded fs::path.string() conversions

pull/1273/head
Hleb Valoshka 2021-12-16 17:16:36 +02:00 committed by ajtribick
parent e4ea8e0df4
commit 50deb54bff
18 changed files with 37 additions and 37 deletions

View File

@ -605,7 +605,7 @@ std::unique_ptr<M3DScene> Read3DSFile(std::istream& in)
std::unique_ptr<M3DScene> Read3DSFile(const fs::path& filename)
{
std::ifstream in(filename.string(), std::ios::in | std::ios::binary);
std::ifstream in(filename, std::ios::in | std::ios::binary);
if (!in.good())
{
GetLogger()->error("Read3DSFile: Error opening {}\n", filename);

View File

@ -141,7 +141,7 @@ fs::path WarpMeshInfo::resolve(const fs::path& baseDir)
WarpMesh* WarpMeshInfo::load(const fs::path& name)
{
#define MESHTYPE_RECT 2
ifstream f(name.string());
ifstream f(name);
if (!f.good())
return nullptr;

View File

@ -82,7 +82,7 @@ NoiseDisplacementFunc(float u, float v, void* info)
std::unique_ptr<cmod::Model>
LoadCelestiaMesh(const fs::path& filename)
{
std::ifstream meshFile(filename.string(), std::ios::in);
std::ifstream meshFile(filename, std::ios::in);
if (!meshFile.good())
{
GetLogger()->error("Error opening mesh file: {}\n", filename);
@ -439,7 +439,7 @@ GeometryInfo::resolve(const fs::path& baseDir)
if (!path.empty())
{
fs::path filename = path / "models" / source;
std::ifstream in(filename.string());
std::ifstream in(filename);
if (in.good())
{
resolvedToPath = true;
@ -480,7 +480,7 @@ GeometryInfo::load(const fs::path& resolvedFilename)
}
else if (fileType == Content_CelestiaModel)
{
std::ifstream in(filename.string(), std::ios::binary);
std::ifstream in(filename, std::ios::binary);
if (in.good())
{
model = cmod::LoadModel(

View File

@ -33,7 +33,7 @@ fs::path RotationModelInfo::resolve(const fs::path& baseDir)
if (!path.empty())
{
fs::path filename = path / "data" / source;
ifstream in(filename.string());
ifstream in(filename);
if (in.good())
return filename;
}

View File

@ -414,14 +414,14 @@ ShaderManager::getShader(const string& name)
return getShader(name, errorVertexShaderSource, errorFragmentShaderSource);
}
ifstream vsf(vsName.string());
ifstream vsf(vsName);
if (!vsf.good())
{
GetLogger()->error("Failed to open {}\n", vsName);
return getShader(name, errorVertexShaderSource, errorFragmentShaderSource);
}
ifstream fsf(fsName.string());
ifstream fsf(fsName);
if (!fsf.good())
{
GetLogger()->error("Failed to open {}\n", fsName);

View File

@ -69,7 +69,7 @@ fs::path TextureInfo::resolve(const fs::path& baseDir)
}
else
{
ifstream in(filename.string());
ifstream in(filename);
if (in.good())
return filename;
}

View File

@ -48,7 +48,7 @@ fs::path TrajectoryInfo::resolve(const fs::path& baseDir)
if (!path.empty())
{
fs::path filename = path / "data" / source;
ifstream in(filename.string());
ifstream in(filename);
if (in.good())
return filename += uniquifyingSuffix;
}

View File

@ -395,7 +395,7 @@ static VirtualTexture* LoadVirtualTexture(istream& in, const fs::path& path)
VirtualTexture* LoadVirtualTexture(const fs::path& filename)
{
ifstream in(filename.string(), ios::in);
ifstream in(filename, ios::in);
if (!in.good())
{

View File

@ -726,7 +726,7 @@ static bool SkipComments(istream& in)
template <typename T> SampledOrbit<T>* LoadSampledOrbit(const fs::path& filename, TrajectoryInterpolation interpolation, T /*unused*/)
{
ifstream in(filename.string());
ifstream in(filename);
if (!in.good())
return nullptr;
@ -781,7 +781,7 @@ template <typename T> SampledOrbit<T>* LoadSampledOrbit(const fs::path& filename
template <typename T> SampledOrbitXYZV<T>* LoadSampledOrbitXYZV(const fs::path& filename, TrajectoryInterpolation interpolation, T /*unused*/)
{
ifstream in(filename.string());
ifstream in(filename);
if (!in.good())
return nullptr;
@ -828,7 +828,7 @@ template <typename T> SampledOrbitXYZV<T>* LoadSampledOrbitXYZV(const fs::path&
template <typename T> SampledOrbitXYZV<T>*
LoadSampledOrbitXYZVBinary(const fs::path& filename, TrajectoryInterpolation interpolation, T /*unused*/)
{
ifstream in(filename.string(), ios::binary);
ifstream in(filename, ios::binary);
if (!in.good())
{
GetLogger()->error(_("Error opening {}.\n"), filename);

View File

@ -218,7 +218,7 @@ SampledOrientation::getOrientation(double tjd) const
RotationModel* LoadSampledOrientation(const fs::path& filename)
{
ifstream in(filename.string());
ifstream in(filename);
if (!in.good())
return nullptr;

View File

@ -236,7 +236,7 @@ void CelestiaCore::readFavoritesFile()
path = WriteableDataPath() / path;
#endif
ifstream in(path.string(), ios::in);
ifstream in(path, ios::in);
if (in.good())
{
favorites = ReadFavoritesList(in);
@ -275,7 +275,7 @@ void CelestiaCore::writeFavoritesFile()
}
}
ofstream out(path.string(), ios::out);
ofstream out(path, ios::out);
if (out.good())
WriteFavoritesList(*favorites, out);
}
@ -3683,7 +3683,7 @@ class SolarSystemLoader
if (notifier != nullptr)
notifier->update(filepath.filename().string());
ifstream solarSysFile(filepath.string(), ios::in);
ifstream solarSysFile(filepath, ios::in);
if (solarSysFile.good())
{
LoadSolarSystemObjects(solarSysFile,
@ -3729,7 +3729,7 @@ template <class OBJDB> class CatalogLoader
if (notifier != nullptr)
notifier->update(filepath.filename().string());
ifstream catalogFile(filepath.string(), ios::in);
ifstream catalogFile(filepath, ios::in);
if (catalogFile.good())
{
if (!objDB->load(catalogFile, filepath.parent_path()))
@ -3837,7 +3837,7 @@ bool CelestiaCore::initSimulation(const fs::path& configFileName,
if (progressNotifier)
progressNotifier->update(file.string());
ifstream dsoFile(file.string(), ios::in);
ifstream dsoFile(file, ios::in);
if (!dsoFile.good())
{
GetLogger()->error(_("Error opening deepsky catalog file {}.\n"), file);
@ -3890,7 +3890,7 @@ bool CelestiaCore::initSimulation(const fs::path& configFileName,
if (progressNotifier)
progressNotifier->update(file.string());
ifstream solarSysFile(file.string(), ios::in);
ifstream solarSysFile(file, ios::in);
if (!solarSysFile.good())
{
GetLogger()->error(_("Error opening solar system catalog {}.\n"), file);
@ -3930,7 +3930,7 @@ bool CelestiaCore::initSimulation(const fs::path& configFileName,
// Load asterisms:
if (!config->asterismsFile.empty())
{
ifstream asterismsFile(config->asterismsFile.string(), ios::in);
ifstream asterismsFile(config->asterismsFile, ios::in);
if (!asterismsFile.good())
{
GetLogger()->error(_("Error opening asterisms file {}.\n"),
@ -3946,7 +3946,7 @@ bool CelestiaCore::initSimulation(const fs::path& configFileName,
if (!config->boundariesFile.empty())
{
ifstream boundariesFile(config->boundariesFile.string(), ios::in);
ifstream boundariesFile(config->boundariesFile, ios::in);
if (!boundariesFile.good())
{
GetLogger()->error(_("Error opening constellation boundaries file {}.\n"),
@ -3963,7 +3963,7 @@ bool CelestiaCore::initSimulation(const fs::path& configFileName,
if (!config->destinationsFile.empty())
{
fs::path localeDestinationsFile = LocaleFilename(config->destinationsFile);
ifstream destfile(localeDestinationsFile.string());
ifstream destfile(localeDestinationsFile, ios::in);
if (destfile.good())
{
destinations = ReadDestinationList(destfile);
@ -4156,7 +4156,7 @@ static void loadCrossIndex(StarDatabase* starDB,
{
if (!filename.empty())
{
ifstream xrefFile(filename.string(), ios::in | ios::binary);
ifstream xrefFile(filename, ios::in | ios::binary);
if (xrefFile.good())
{
if (!starDB->loadCrossIndex(catalog, xrefFile))
@ -4174,7 +4174,7 @@ bool CelestiaCore::readStars(const CelestiaConfig& cfg,
StarDetails::SetStarTextures(cfg.starTextures);
StarNameDatabase* starNameDB = nullptr;
ifstream starNamesFile(cfg.starNamesFile.string(), ios::in);
ifstream starNamesFile(cfg.starNamesFile, ios::in);
if (starNamesFile.good())
{
starNameDB = StarNameDatabase::readNames(starNamesFile);
@ -4194,7 +4194,7 @@ bool CelestiaCore::readStars(const CelestiaConfig& cfg,
if (progressNotifier)
progressNotifier->update(cfg.starDatabaseFile.string());
ifstream starFile(cfg.starDatabaseFile.string(), ios::in | ios::binary);
ifstream starFile(cfg.starDatabaseFile, ios::in | ios::binary);
if (!starFile.good())
{
GetLogger()->error(_("Error opening {}\n"), cfg.starDatabaseFile);
@ -4227,7 +4227,7 @@ bool CelestiaCore::readStars(const CelestiaConfig& cfg,
if (file.empty())
continue;
ifstream starFile(file.string(), ios::in);
ifstream starFile(file, ios::in);
if (starFile.good())
starDB->load(starFile);
else
@ -4880,7 +4880,7 @@ CelestiaCore::TemperatureScale CelestiaCore::getTemperatureScale() const
void CelestiaCore::setLogFile(const fs::path &fn)
{
m_logfile = std::ofstream(fn.string());
m_logfile = std::ofstream(fn);
if (m_logfile.good())
{
m_tee = teestream(m_logfile, *console);

View File

@ -34,7 +34,7 @@ static unsigned int getUint(Hash* params,
CelestiaConfig* ReadCelestiaConfig(const fs::path& filename, CelestiaConfig *config)
{
ifstream configFile(filename.string());
ifstream configFile(filename);
if (!configFile.good())
{
GetLogger()->error("Error opening config file '{}'.\n", filename);

View File

@ -1619,7 +1619,7 @@ QMenu* CelestiaAppWindow::buildScriptsMenu()
for (const auto& script : *scripts)
{
QAction* act = new QAction(script.title.c_str(), this);
act->setData(script.filename.string().c_str());
act->setData(script.filename.c_str());
connect(act, SIGNAL(triggered()), this, SLOT(slotOpenScript()));
menu->addAction(act);
}

View File

@ -36,7 +36,7 @@ static void process(const fs::path& p, vector<ScriptMenuItem>* menuItems)
// Scan the script file for metainformation. At the moment,
// the only thing searched for is the script title, which must
// appear on the first line after the string 'Title:'
ifstream in(p.string());
ifstream in(p);
if (in.good())
{
ScriptMenuItem item;

View File

@ -499,7 +499,7 @@ bool LoadItemTextFromFile(HWND hWnd,
const fs::path& filename)
{
// ifstream textFile(filename, ios::in | ios::binary);
ifstream textFile(filename.string(), ios::in);
ifstream textFile(filename, ios::in);
string s;
if (!textFile.good())

View File

@ -137,7 +137,7 @@ uint32_t* decompressDXTc(uint32_t width, uint32_t height, GLenum format, bool tr
Image* LoadDDSImage(const fs::path& filename)
{
ifstream in(filename.string(), ios::in | ios::binary);
ifstream in(filename, ios::in | ios::binary);
if (!in.good())
{
GetLogger()->error("Error opening DDS texture file {}.\n", filename);

View File

@ -88,7 +88,7 @@ bool LegacyScriptPlugin::isOurFile(const fs::path &p) const
unique_ptr<IScript> LegacyScriptPlugin::loadScript(const fs::path &path)
{
ifstream scriptfile(path.string());
ifstream scriptfile(path);
if (!scriptfile.good())
{
appCore()->fatalError(_("Error opening script file."));

View File

@ -84,7 +84,7 @@ bool LuaScriptPlugin::isOurFile(const fs::path &p) const
unique_ptr<IScript> LuaScriptPlugin::loadScript(const fs::path &path)
{
ifstream scriptfile(path.string());
ifstream scriptfile(path);
if (!scriptfile.good())
{
appCore()->fatalError(fmt::sprintf(_("Error opening script '%s'"), path));
@ -209,7 +209,7 @@ bool CreateLuaEnvironment(CelestiaCore *appCore, const CelestiaConfig *config, P
// Execute the Lua hook initialization script
if (!config->luaHook.empty())
{
ifstream scriptfile(config->luaHook.string());
ifstream scriptfile(config->luaHook);
if (!scriptfile.good())
appCore->fatalError(fmt::sprintf(_("Error opening LuaHook '%s'"), config->luaHook));