We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
my code gets the file name fine but fails to get the extension
Heres my code: void get_files(std::string fpath, std::string extension, stringVec &vec) {
tinydir_dir dir; if (fpath.back() != '/') fpath += "/"; tinydir_open_sorted(&dir, fpath.c_str()); for (unsigned i = 0; i < dir.n_files; i++) { tinydir_file file; tinydir_readfile_n(&dir, &file, i); if (file.is_dir) { if (strcmp(file.name, ".") != 0 && strcmp(file.name, "..") != 0) { get_files(fpath + file.name + "/", extension, vec); } } else { std::cout << "File:" << std::endl; std::cout << file.name << std::endl; std::cout << "Extension:" << std::endl; std::cout << file.extension << std::endl; if (strcmp(file.extension, extension.c_str()) == 1) { std::string resource = fpath + file.name; vec.push_back(resource); } } } tinydir_close(&dir);
}
Heres the output:
File: obj_cheeseboy.hpp Extension:
File: room_1.xml Extension:
File: sprite_1.xml Extension: eboy.hpp
somehow it misses all the extensions and gives me garbage for last one?
The text was updated successfully, but these errors were encountered:
68983ed
Thanks for raising; fixed bug, please try now.
Sorry, something went wrong.
No branches or pull requests
my code gets the file name fine but fails to get the extension
Heres my code:
void get_files(std::string fpath, std::string extension, stringVec &vec)
{
}
Heres the output:
File:
obj_cheeseboy.hpp
Extension:
File:
room_1.xml
Extension:
File:
sprite_1.xml
Extension:
eboy.hpp
somehow it misses all the extensions and gives me garbage for last one?
The text was updated successfully, but these errors were encountered: