File tree Expand file tree Collapse file tree 1 file changed +6
-8
lines changed Expand file tree Collapse file tree 1 file changed +6
-8
lines changed Original file line number Diff line number Diff line change 2222#include " ggml.h"
2323#include " llama.h"
2424#include " llama-context.h"
25+ #include < filesystem>
2526
2627#ifdef _WIN32
2728# define WIN32_LEAN_AND_MEAN
@@ -879,14 +880,11 @@ static std::vector<cmd_params_instance> get_cmd_params_instances(const cmd_param
879880 * @param path The input model path information.
880881 * @return Full name of the model.
881882 */
882- static std::string get_modelfile_name (const std::string & path) {
883- size_t index = path.find_last_of (' /' );
884- if (index != std::string::npos) {
885- std::string filename = path.substr (index + 1 );
886- return filename;
887- } else {
888- return path;
889- }
883+ static std::string get_modelfile_name (const std::string & path_str) {
884+ namespace fs = std::filesystem;
885+ fs::path path = path_str;
886+
887+ return path.filename ();
890888}
891889
892890struct test {
You can’t perform that action at this time.
0 commit comments