Use more filesystem::path where applicable

This commit is contained in:
Alexander Bock
2024-04-06 19:50:39 +02:00
parent 2af06fb641
commit 4328476d26
148 changed files with 712 additions and 705 deletions

View File

@@ -42,7 +42,7 @@ namespace {
namespace openspace {
TransferFunction::TransferFunction(const std::string& filepath,
TransferFunction::TransferFunction(const std::filesystem::path& filepath,
TfChangedCallback tfChangedCallback)
: _filepath(filepath)
{
@@ -52,7 +52,7 @@ TransferFunction::TransferFunction(const std::string& filepath,
TransferFunction::~TransferFunction() {}
void TransferFunction::setPath(const std::string& filepath) {
void TransferFunction::setPath(const std::filesystem::path& filepath) {
if (_file) {
_file = nullptr;
}
@@ -95,11 +95,10 @@ void TransferFunction::setCallback(TfChangedCallback callback) {
}
void TransferFunction::setTextureFromTxt() {
std::ifstream in;
in.open(_filepath);
std::ifstream in = std::ifstream(_filepath);
if (!in.is_open()) {
throw ghoul::FileNotFoundError(_filepath.string());
throw ghoul::FileNotFoundError(_filepath);
}
int width = 512;
@@ -209,7 +208,7 @@ void TransferFunction::setTextureFromTxt() {
}
void TransferFunction::setTextureFromImage() {
_texture = ghoul::io::TextureReader::ref().loadTexture(_filepath.string(), 1);
_texture = ghoul::io::TextureReader::ref().loadTexture(_filepath, 1);
_texture->setWrapping(ghoul::opengl::Texture::WrappingMode::ClampToEdge);
}