change method to find '/' as the suggestion of @sheinz

This commit is contained in:
Tuan PM 2017-01-04 16:27:20 +07:00
parent 028bc01414
commit 8be2c20a4f

View file

@ -199,13 +199,9 @@ static bool process_directory(const char *direcotry)
} }
sprintf(path, "%s/%s", direcotry, ep->d_name); sprintf(path, "%s/%s", direcotry, ep->d_name);
filename = path; filename = path;
file_ptr = path; filename = strchr(path, '/');
while(*file_ptr != 0 && *file_ptr != '/') { filename = filename ? &filename[1] : path;
file_ptr ++;
}
if(*file_ptr != 0) {
filename = file_ptr + 1;
}
printf("Processing file source %s, dest: %s\n", path, filename); printf("Processing file source %s, dest: %s\n", path, filename);
if (!process_file(path, filename)) { if (!process_file(path, filename)) {
printf("Error processing file\n"); printf("Error processing file\n");