CRAB: Print cleansedPath instead of normal path in warnings

This commit is contained in:
hax0kartik 2023-08-10 17:14:26 +05:30 committed by Eugene Sandulenko
parent 6fb80da1a1
commit 0d111de090
3 changed files with 12 additions and 8 deletions

View File

@ -48,8 +48,9 @@ bool fileOpen(const Common::Path &path, char *&data) {
delete[] data;
Common::File file;
if (!file.open(cleansePath(path.toString()))) {
warning("Unable to open file %s", path.toString().c_str());
Common::String cleansedPath = cleansePath(path.toString());
if (!file.open(cleansedPath)) {
warning("Unable to open file %s", cleansedPath.c_str());
data = nullptr;
return false;
}
@ -73,8 +74,9 @@ bool fileOpen(const Common::Path &path, Common::File *file) {
if (file->isOpen())
file->close();
if (!file->open(cleansePath(path.toString()))) {
warning("Unable to open file %s", path.toString().c_str());
Common::String cleansedPath = cleansePath(path.toString());
if (!file->open(cleansedPath)) {
warning("Unable to open file %s", cleansedPath.c_str());
return false;
}

View File

@ -131,13 +131,14 @@ bool MusicManager::load(rapidxml::xml_node<char> *node) {
rapidxml::xml_attribute<char> *id = n->first_attribute("id"), *path = n->first_attribute("path");
if (id != nullptr && path != nullptr) {
EffectAudio *audio = new EffectAudio();
if (audio->_file.open(cleansePath(path->value()))) {
Common::String cleansedPath = cleansePath(path->value());
if (audio->_file.open(cleansedPath)) {
audio->_handle = new Audio::SoundHandle();
audio->_stream = Audio::makeWAVStream(&audio->_file, DisposeAfterUse::NO);
_effects[stringToNumber<ChunkKey>(id->value())] = audio;
} else {
delete audio;
warning("Could not open audio file : %s", path->value());
warning("Could not open audio file : %s", cleansedPath.c_str());
return false;
}
}

View File

@ -75,12 +75,13 @@ struct MusicData {
loadNum(_id, "id", node);
loadNum(_fadeInDuration, "fade_in", node);
if (_file.open(cleansePath(node->first_attribute("path")->value()))) {
Common::String cleansedPath = cleansePath(node->first_attribute("path")->value());
if (_file.open(cleansedPath)) {
Audio::SeekableAudioStream *stream = Audio::makeVorbisStream(&_file, DisposeAfterUse::NO);
// loops=0 means infinite here.
_track = Audio::makeLoopingAudioStream(stream, 0, 0, 0);
} else {
warning("Could not open file %s", node->first_attribute("path")->value());
warning("Could not open file %s", cleansedPath.c_str());
}
}
};