#include "../src/opticalflow.h"
#endif
+// Uncomment this to test some filename processing
+//#define DEBUG_FILENAME
+
/* functions to load directory */
typedef struct dir_entry {
int i;
/* read linked list */
- dir = opendir(path);
- if (!dir)
+ if (path == NULL || path[0] == '\0')
+ dir = opendir(".");
+ else
+ dir = opendir(path);
+ if (!dir) {
+#ifdef DEBUG_FILENAME
+ printf("Failed to open directory: path='%s'\n", path);
+#endif
return NULL;
+ }
while (1) {
rc = readdir_r(dir, &dirent, &result);
if (rc < 0)
}
*entryp = entry;
entryp = &entry->next;
+#ifdef DEBUG_FILENAME
+ printf("Fetching entry: path='%s' filename='%s'\n", path, result->d_name);
+#endif
strcpy(entry->name, path);
strcat(entry->name, result->d_name);
count++;
for (i = 0; i < count; i++) {
/* relink */
entry = list[i];
+#ifdef DEBUG_FILENAME
+ printf("Sorted full name: '%s'\n", entry->name);
+#endif
entry->next = NULL;
*entryp = entry;
entryp = &entry->next;
}
/* get path of given file name */
-static char *get_path(const char *filename)
+static const char *get_path(const char *filename)
{
static char path[256];
}
if (*p < '0' || *p > '9') {
single_file:
-// printf("single file\n");
frame_list = malloc(sizeof(struct frame_list));
memset(frame_list, 0, sizeof(struct frame_list));
strcpy(frame_list[0].filename, filename);
rc = colorize(I, mI, flow, flow_i, in_itr_num, out_itr_num, target_residual_change, quick, scalexyz, feat_names, NULL);
if (rc < 0) {
if (k > 1)
- printf("No memory! Use smaller frames or less frames between key frames or add more memory.");
+ printf("No memory! Use smaller frames or less frames between key frames or add more memory.\n");
else
- printf("No memory! Use smaller image or add more memory.");
+ printf("No memory! Use smaller image or add more memory.\n");
exit(-1);
}
}