Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
iternlm authored Jan 15, 2020
1 parent 1d97eec commit adc923f
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions iterNLM_v0.3/Geometry/hdcommunication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ namespace hdcom
}
return (info.st_mode & S_IFDIR) != 0;
}
bool file_exists(const std::string& filename)
{
struct stat buffer;
return (stat (filename.c_str(), &buffer) == 0);
}
std::string zfill_int2string(int inint, const unsigned int &zfill)
{
std::string outstring = std::to_string(inint);
Expand All @@ -48,10 +53,29 @@ namespace hdcom
std::vector<std::string> filelist;

if(hasEnding(path, "tif") || hasEnding(path, "tiff"))
{
filelist.push_back(path);

if(!file_exists(path)) filelist[0] = "missing";
return filelist;
}
else
{
if(!path_exists(path))
{
filelist.push_back("missing");
return filelist;
}

GetFilelist(path+"/", filelist);

if (filelist.size() == 0)
{
filelist.push_back("no tif");
return filelist;
}
}

char *inpath;
inpath = new char[filelist[0].length()+1];
strcpy(inpath, filelist[0].c_str());
Expand Down

0 comments on commit adc923f

Please sign in to comment.