Checking if path or extension is not empty
This commit is contained in:
parent
1ea2827c62
commit
4aa2e3c934
|
@ -17,7 +17,7 @@ namespace carla {
|
||||||
|
|
||||||
void FileSystem::ValidateFilePath(std::string &filepath, const std::string &ext) {
|
void FileSystem::ValidateFilePath(std::string &filepath, const std::string &ext) {
|
||||||
fs::path path(filepath);
|
fs::path path(filepath);
|
||||||
if (path.extension() != ext)
|
if (!ext.empty() && path.extension() != ext)
|
||||||
path.replace_extension(ext);
|
path.replace_extension(ext);
|
||||||
auto parent = path.parent_path();
|
auto parent = path.parent_path();
|
||||||
if (!fs::exists(parent))
|
if (!fs::exists(parent))
|
||||||
|
|
|
@ -538,7 +538,7 @@ void FCarlaServer::FPimpl::BindActions()
|
||||||
REQUIRE_CARLA_EPISODE();
|
REQUIRE_CARLA_EPISODE();
|
||||||
|
|
||||||
// Check that the path ends in a slash, add it otherwise
|
// Check that the path ends in a slash, add it otherwise
|
||||||
if (folder[folder.size() - 1] != '/' && folder[folder.size() - 1] != '\\') {
|
if (!folder.empty() && folder[folder.size() - 1] != '/' && folder[folder.size() - 1] != '\\') {
|
||||||
folder += "/";
|
folder += "/";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue