Skip to content
Snippets Groups Projects
Verified Commit 5ed29d22 authored by Thibault Payet's avatar Thibault Payet
Browse files

Add an option to just convert a txt with same output name

parent 951bf8c1
No related branches found
No related tags found
No related merge requests found
......@@ -10,7 +10,7 @@
void txt2pcd( std::filesystem::path input, std::filesystem::path output )
{
std::ifstream inputFile{input.c_str()};
std::ifstream inputFile{ input.c_str() };
if ( inputFile )
{
......@@ -20,7 +20,7 @@ void txt2pcd( std::filesystem::path input, std::filesystem::path output )
std::string line;
auto len = inputFile.tellg();
char buf{'\0'};
char buf{ '\0' };
do
{
......@@ -104,7 +104,7 @@ void txt2pcd( std::filesystem::path input, std::filesystem::path output )
void printHelp()
{
std::cout << "Usage: txt2pcd inputCloud.txt outputCloud.pcd\n";
std::cout << "Usage: txt2pcd inputCloud.txt [outputCloud.pcd]\n";
}
int main( int argc, char** argv )
......@@ -120,6 +120,14 @@ int main( int argc, char** argv )
std::cerr << e.what() << "\n";
}
}
else if ( argc == 2 )
{
auto basefilename = std::filesystem::path{ argv[ 1 ] };
auto outfilename = basefilename;
outfilename.replace_extension( std::filesystem::path{ "pcd" } );
txt2pcd( basefilename, outfilename );
}
else
{
printHelp();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment