string ofApp::extension_from_file(string file) {
int index = file.find_last_of('.');
if (index != -1) {
string extension = file.substr(index+1);
extension = ofToLower(extension);
return extension;
}
return NULL;
}
I have a problem in another part where I try:
if (extension != NULL) {
I get a:
comparison between NULL and non-pointer
What would be a good way to resolve this?
I could return a empty string, a pointer and maybe something else. But I have problems making a decision based on good reasoning.
So it returns empty when no extension, and arguably the wrong extension for .tar.gz. You’re code would do the same. I don’t know what is right. What if the file names is one.of.the.best.jpg?
Update: maybe it’s the right thing after all, you could process the gz first, and then untar it, right?