Remove old shots from inside the player

Now that exu are supported, it is better that the player deals with the
destination management, including removing the old shots if the
destination is a directory.
master
Daniel Zaoui 4 years ago
parent 9506ce55e8
commit 6f74e380a4
  1. 45
      src/bin/exactness.c
  2. 20
      src/bin/player.c

@ -265,35 +265,6 @@ ok:
return EINA_TRUE;
}
static Eina_Bool
_check_prefix(const char *prefix, const char *name)
{
unsigned int len = strlen(prefix);
return (!strncmp(name, prefix, len) && (strlen(name) > len) && (name[len] == SHOT_DELIMITER));
}
static void
_prefix_rm_cb(const char *name, const char *path, void *data)
{
const char *prefix = data;
if (_check_prefix(prefix, name))
{
char *buf = alloca(strlen(path) + strlen(name));
sprintf(buf, "%s/%s", path, name);
if (unlink(buf))
{
printf("Failed deleting '%s/%s': ", path, name);
perror("");
}
}
}
static void
_run_test_prefix_rm(const char *dir, const char *prefix)
{
eina_file_dir_list(dir, 0, _prefix_rm_cb, (void *) prefix);
}
static void
_job_compare(void *data)
{
@ -345,22 +316,6 @@ _job_consume()
_running_jobs++;
_tests_executed++;
switch (_mode)
{
case RUN_PLAY:
{
_run_test_prefix_rm(CURRENT_SUBDIR, ent->name);
_printf(1, "Running %s\n", ent->name);
break;
}
case RUN_INIT:
{
_run_test_prefix_rm(ORIG_SUBDIR, ent->name);
break;
}
default: break;
}
if (!job_del_callback_handler)
{
job_del_callback_handler = ecore_event_handler_add(ECORE_EXE_EVENT_DEL,

@ -944,6 +944,23 @@ _mkdir(const char *path, Eina_Bool skip_last)
return EINA_TRUE;
}
static void
_old_shots_rm_cb(const char *name, const char *path, void *data)
{
const char *prefix = data;
unsigned int len = strlen(prefix);
if (!strncmp(name, prefix, len) && (strlen(name) > len) && (name[len] == SHOT_DELIMITER))
{
char *buf = alloca(strlen(path) + strlen(name));
sprintf(buf, "%s/%s", path, name);
if (unlink(buf))
{
printf("Failed deleting '%s/%s': ", path, name);
perror("");
}
}
}
static Evas *
_my_evas_new(int w EINA_UNUSED, int h EINA_UNUSED)
{
@ -1121,6 +1138,9 @@ int main(int argc, char **argv)
if (_dest_type == FTYPE_EXU) _dest_unit = calloc(1, sizeof(*_dest_unit));
if (_dest_type == FTYPE_DIR && _test_name)
eina_file_dir_list(_dest, 0, _old_shots_rm_cb, (void *)_test_name);
if (!_src_open())
{
fprintf(stderr, "Unable to read source file\n");

Loading…
Cancel
Save