/* Returns 0 when we found some font files, otherwise < 0. */ int KankerApp::getFontFiles(std::vector<std::string>& files) { std::vector<std::string> full_paths; full_paths = rx_get_files(rx_to_data_path("fonts"), "xml"); if (0 == full_paths.size()) { return -1; } for (size_t i = 0; i < full_paths.size(); ++i) { files.push_back(rx_strip_dir(full_paths[i])); } return 0; }
/* scans the watch dir, just call this ones to process files which for which no event was given */ int DirWatcher::scandir() { if (0 == directory.size()) { RX_ERROR("Directory is not set, cannot scan the dir."); return -1; } if (NULL == on_rename) { RX_ERROR("Not sanning director: %s because the on_rename callback is not set.", directory.c_str()); return -2; } if (false == rx_is_dir(directory)) { RX_ERROR("Cannot scan the directory because it's not a dir: %s", directory.c_str()); return -3; } std::vector<std::string> files = rx_get_files(directory, "*"); for (size_t i = 0; i < files.size(); ++i) { on_rename(directory, rx_strip_dir(files[i]), user); } return 0; }