forked from enlightenment/enlightenment
handle spaces in eap filenames when editing, and proeprly escape things, add
gneric escaper, and reduce file path of icon files nicely. SVN revision: 22587
This commit is contained in:
parent
b24ee237c5
commit
81c249ddeb
1
TODO
1
TODO
|
@ -8,7 +8,6 @@ Some of the things (in very short form) that need to be done to E17...
|
|||
BUGS / FIXES
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
* BUG: eap editor doesn't handle spaces in file paths for the .eap
|
||||
* BUG: ghost windows happen if windows close when on another desktop or if
|
||||
windows are very short-lived
|
||||
* BUG: k3b has minimization issues when burning cds (it tries to unminimize
|
||||
|
|
|
@ -1419,7 +1419,7 @@ e_app_icon_add(Evas *evas, E_App *a)
|
|||
static int
|
||||
_e_app_new_save(E_App *a)
|
||||
{
|
||||
static char tmpn[1024];
|
||||
static char tmpn[4096];
|
||||
int fd = 0, ret = 0;
|
||||
char cmd[2048];
|
||||
char ipart[512];
|
||||
|
@ -1446,20 +1446,13 @@ _e_app_new_save(E_App *a)
|
|||
}
|
||||
|
||||
i = 0;
|
||||
|
||||
if (a->image)
|
||||
{
|
||||
start = strchr(a->image, '/');
|
||||
end = strrchr(a->image ,'/');
|
||||
end = strrchr(a->image, '/');
|
||||
|
||||
if (start == end)
|
||||
{
|
||||
imgdir = strdup("/");;
|
||||
}
|
||||
else if ((!start) || (!end))
|
||||
{
|
||||
imgdir = strdup("");
|
||||
}
|
||||
if (start == end) imgdir = strdup("/");
|
||||
else if ((!start) || (!end)) imgdir = strdup("");
|
||||
else
|
||||
{
|
||||
imgdir = malloc((end - start + 1));
|
||||
|
@ -1473,24 +1466,27 @@ _e_app_new_save(E_App *a)
|
|||
|
||||
if (imgdir)
|
||||
{
|
||||
snprintf(ipart, sizeof(ipart), "-id %s", imgdir);
|
||||
snprintf(ipart, sizeof(ipart), "-id %s",
|
||||
e_util_filename_escape(imgdir));
|
||||
free(imgdir);
|
||||
}
|
||||
else ipart[0] = '\0';
|
||||
else ipart[0] = 0;
|
||||
|
||||
if (a->image)
|
||||
{
|
||||
if (a->width <= 0)
|
||||
a->width = EAP_MIN_WIDTH;
|
||||
if (a->height <= 0)
|
||||
a->height = EAP_MIN_HEIGHT;
|
||||
fprintf(out, EAP_EDC_TMPL, a->image, a->width, a->height, a->image);
|
||||
if (a->width <= 0) a->width = EAP_MIN_WIDTH;
|
||||
if (a->height <= 0) a->height = EAP_MIN_HEIGHT;
|
||||
fprintf(out, EAP_EDC_TMPL,
|
||||
e_util_filename_escape(ecore_file_get_file(a->image)),
|
||||
a->width, a->height,
|
||||
e_util_filename_escape(ecore_file_get_file(a->image)));
|
||||
}
|
||||
else
|
||||
fprintf(out, EAP_EDC_TMPL_EMPTY);
|
||||
fclose(out);
|
||||
|
||||
snprintf(cmd, sizeof(cmd), "edje_cc -v %s %s %s", ipart, tmpn, a->path);
|
||||
snprintf(cmd, sizeof(cmd), "edje_cc -v %s %s %s", ipart, tmpn,
|
||||
e_util_filename_escape(a->path));
|
||||
ret = system(cmd);
|
||||
|
||||
if (ret < 0)
|
||||
|
@ -1500,7 +1496,7 @@ _e_app_new_save(E_App *a)
|
|||
return 0;
|
||||
}
|
||||
|
||||
unlink(tmpn);
|
||||
ecore_file_unlink(tmpn);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -527,6 +527,38 @@ e_util_dialog_internal(const char *title, const char *txt)
|
|||
e_dialog_show(dia);
|
||||
}
|
||||
|
||||
EAPI const char *
|
||||
e_util_filename_escape(const char *filename)
|
||||
{
|
||||
char *p, *q;
|
||||
static char buf[4096];
|
||||
|
||||
p = filename;
|
||||
q = buf;
|
||||
while (*p)
|
||||
{
|
||||
if ((q - buf) > 4090) return NULL;
|
||||
if (
|
||||
(*p == ' ') || (*p == '\t') || (*p == '\n') ||
|
||||
(*p == '\\') || (*p == '\'') || (*p == '\"') ||
|
||||
(*p == ';') || (*p == '!') || (*p == '#') ||
|
||||
(*p == '$') || (*p == '%') || (*p == '&') ||
|
||||
(*p == '*') || (*p == '(') || (*p == ')') ||
|
||||
(*p == '[') || (*p == ']') || (*p == '{') ||
|
||||
(*p == '}') || (*p == '|') || (*p == '<') ||
|
||||
(*p == '>') || (*p == '?')
|
||||
)
|
||||
{
|
||||
*q = '\\';
|
||||
q++;
|
||||
}
|
||||
*q = *p;
|
||||
q++;
|
||||
p++;
|
||||
}
|
||||
return buf;
|
||||
}
|
||||
|
||||
/* local subsystem functions */
|
||||
static void
|
||||
_e_util_container_fake_mouse_up_cb(void *data)
|
||||
|
|
|
@ -39,6 +39,7 @@ EAPI E_Border *e_util_desk_border_above(E_Border *bd);
|
|||
EAPI E_Border *e_util_desk_border_below(E_Border *bd);
|
||||
EAPI int e_util_edje_collection_exists(const char *file, const char *coll);
|
||||
EAPI void e_util_dialog_internal(const char *title, const char *txt);
|
||||
EAPI const char *e_util_filename_escape(const char *filename);
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue