fix tcat relative paths.

SVN revision: 83386
This commit is contained in:
Carsten Haitzler 2013-01-28 16:43:45 +00:00
parent 2781da8076
commit a5bc0be3c9
2 changed files with 53 additions and 41 deletions

View File

@ -25,6 +25,7 @@ requirements="\
evas >= 1.7.0 \
ecore >= 1.7.0 \
ecore-evas >= 1.7.0 \
ecore-file >= 1.7.0 \
edje >= 1.7.0 \
emotion >= 1.7.0 \
ecore-input >= 1.7.0 \

View File

@ -2,6 +2,7 @@
#include <Ecore.h>
#include <Evas.h>
#include <Ecore_Evas.h>
#include <Ecore_File.h>
#include <termios.h>
#include <stdio.h>
#include <stdlib.h>
@ -56,6 +57,7 @@ main(int argc, char **argv)
}
eina_init();
ecore_init();
ecore_file_init();
evas_init();
ecore_evas_init();
ee = ecore_evas_buffer_new(1, 1);
@ -65,9 +67,18 @@ main(int argc, char **argv)
evas = ecore_evas_get(ee);
o = evas_object_image_add(evas);
echo_off();
snprintf(buf, sizeof(buf), "%c}qs", 0x1b);
write(0, buf, strlen(buf) + 1);
if (scanf("%i;%i;%i;%i", &tw, &th, &cw, &ch) != 4)
{
echo_on();
return 0;
}
echo_on();
for (i = 1; i < argc; i++)
{
char *path;
char *path, *rp;
if (!strcmp(argv[i], "-c"))
{
@ -89,23 +100,20 @@ main(int argc, char **argv)
}
path = argv[i];
evas_object_image_file_set(o, path, NULL);
rp = ecore_file_realpath(path);
if (rp)
{
evas_object_image_file_set(o, rp, NULL);
evas_object_image_size_get(o, &w, &h);
if ((w >= 0) && (h > 0))
{
int x, y;
echo_off();
snprintf(buf, sizeof(buf), "%c}qs", 0x1b);
write(0, buf, strlen(buf) + 1);
if (scanf("%i;%i;%i;%i", &tw, &th, &cw, &ch) != 4)
if ((tw <= 0) || (th <= 0) || (cw <= 1) || (ch <= 1))
{
echo_on();
free(rp);
continue;
}
echo_on();
if ((tw <= 0) || (th <= 0) || (cw <= 1) || (ch <= 1))
continue;
if (w > (tw * cw))
{
iw = tw;
@ -118,13 +126,13 @@ main(int argc, char **argv)
}
if (mode == CENTER)
snprintf(buf, sizeof(buf), "%c}ic%i;%i;%s",
0x1b, iw, ih, path);
0x1b, iw, ih, rp);
else if (mode == FILL)
snprintf(buf, sizeof(buf), "%c}if%i;%i;%s",
0x1b, iw, ih, path);
0x1b, iw, ih, rp);
else
snprintf(buf, sizeof(buf), "%c}is%i;%i;%s",
0x1b, iw, ih, path);
0x1b, iw, ih, rp);
write(0, buf, strlen(buf) + 1);
for (y = 0; y < ih; y++)
{
@ -135,12 +143,15 @@ main(int argc, char **argv)
write(0, "\n", 1);
}
}
free(rp);
}
}
// ecore_main_loop_begin();
ecore_evas_free(ee);
}
ecore_evas_shutdown();
evas_shutdown();
ecore_file_shutdown();
ecore_shutdown();
eina_shutdown();
return 0;