summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 23e15ee)
raw | patch | inline | side by side (parent: 23e15ee)
author | keescook <keescook@users.sourceforge.net> | |
Sun, 17 Feb 2008 01:40:25 +0000 (01:40 +0000) | ||
committer | keescook <keescook@users.sourceforge.net> | |
Sun, 17 Feb 2008 01:40:25 +0000 (01:40 +0000) |
src/ui/dialog/ocaldialogs.cpp | patch | blob | history |
index 0c20ffa43ae2058cbe988dd3f97fed28d3101736..dfeea700be58804072969572784cc64b1e47d8bc 100644 (file)
GnomeVFSResult result;
guint8 buffer[8192];
+ // FIXME: this would be better as a per-user OCAL cache of files
+ // instead of filling /tmp with downloads.
+ //
// create file path
- const std::string tmptemplate = "ocal-XXXXXX";
+ const std::string tmptemplate = "ocal-";
std::string tmpname;
int fd = Glib::file_open_tmp(tmpname, tmptemplate);
if (fd<0) return;
close(fd);
- Glib::ustring myFilename = Glib::path_get_dirname(tmpname);
- myFilename.append(G_DIR_SEPARATOR_S);
+ // make sure we don't collide with other users on the same machine
+ Glib::ustring myFilename = tmpname;
+ myFilename.append("-");
myFilename.append(get_text(posArray[0], 2));
+ // rename based on original image's name, retaining extension
if (rename(tmpname.c_str(),myFilename.c_str())<0) {
unlink(tmpname.c_str());
g_warning("Error creating destination file '%s': %s", myFilename.c_str(), strerror(errno));