Add usage of command line.
This commit is contained in:
41
src/common/fileHelper.cpp
Normal file
41
src/common/fileHelper.cpp
Normal file
@@ -0,0 +1,41 @@
|
||||
#include "fileHelper.h"
|
||||
|
||||
#include <sys/stat.h>
|
||||
|
||||
std::string Recon::getPath(const std::string &aFullPath)
|
||||
{
|
||||
size_t pos = aFullPath.find_last_of('/');
|
||||
if (pos != std::string::npos)
|
||||
{
|
||||
return aFullPath.substr(0, pos);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
bool Recon::endsWithMat(const std::string &aStr)
|
||||
{
|
||||
if (aStr.length() >= 4)
|
||||
{
|
||||
return (aStr.compare(aStr.length() - 4, 4, ".mat") == 0);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Recon::isDirectory(const std::string &aPath)
|
||||
{
|
||||
struct stat info;
|
||||
if (stat(aPath.c_str(), &info) != 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return (info.st_mode & S_IFDIR) != 0;
|
||||
}
|
||||
|
||||
std::string Recon::fixPathSlash(const std::string& aPath)
|
||||
{
|
||||
if(aPath.back() == '/')
|
||||
{
|
||||
return aPath;
|
||||
}
|
||||
return aPath + '/';
|
||||
}
|
||||
18
src/common/fileHelper.h
Normal file
18
src/common/fileHelper.h
Normal file
@@ -0,0 +1,18 @@
|
||||
#ifndef FILE_HELPER_H
|
||||
#define FILE_HELPER_H
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace Recon
|
||||
{
|
||||
const std::string DEFAULT_CONFIG_PATH = "/home/sun/UR/build/";
|
||||
const std::string DEFAULT_OUTPUT_PATH = "/home/sun/USCT_Result.mat";
|
||||
const std::string DEFAULT_OUTPUT_FILENAME = "USCT_Result.mat";
|
||||
|
||||
std::string getPath(const std::string &aFullPath);
|
||||
bool endsWithMat(const std::string &aStr);
|
||||
bool isDirectory(const std::string &aPath);
|
||||
std::string fixPathSlash(const std::string& aPath);
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user