提交 ced925cf 编写于 作者: F freeHackOfJeff 提交者: Calvin Miao

Localization: refactor GetFileSize method

上级 aba03bdc
......@@ -42,16 +42,12 @@ bool system::CreateDirectory(const std::string& path) {
bool system::GetFileSize(const std::string& path, unsigned int* size) {
boost::filesystem::path p(path);
if (boost::filesystem::exists(p)) {
if (boost::filesystem::is_regular_file(p)) {
*size = static_cast<unsigned int>(boost::filesystem::file_size(p));
return true;
} else {
return false;
}
} else {
return false;
if (boost::filesystem::exists(p) && boost::filesystem::is_regular_file(p)) {
*size = static_cast<unsigned int>(boost::filesystem::file_size(p));
return true;
}
return false;
}
bool system::CopyFile(const std::string& src, const std::string& dst,
......@@ -68,11 +64,12 @@ bool system::CopyFile(const std::string& src, const std::string& dst,
path_src, path_dst, boost::filesystem::copy_option::overwrite_if_exists,
error);
}
if (!error) {
return true;
} else {
if (error) {
return false;
}
return true;
}
void system::GetFilesInFolderRecursive(const std::string& folder,
......
......@@ -108,9 +108,7 @@ void Buffer::SubscriptionCallbackImpl(
static_msgs_.push_back(trans_stamped);
}
setTransform(trans_stamped, authority, is_static);
}
catch (tf2::TransformException& ex) {
} catch (tf2::TransformException& ex) {
std::string temp = ex.what();
AERROR << "Failure to set recieved transform:" << temp.c_str();
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册