summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKees Cook <kees@outflux.net>2008-02-17 01:40:25 +0000
committerkeescook <keescook@users.sourceforge.net>2008-02-17 01:40:25 +0000
commit3e051884e48f668545964b6b0920db0d879514a4 (patch)
tree54183ea864faafbe9eb04f0a2e8c87f65cc6e020 /src
parentfix bug #191847, based on patch from Lubomir Kundrak (diff)
downloadinkscape-3e051884e48f668545964b6b0920db0d879514a4.tar.gz
inkscape-3e051884e48f668545964b6b0920db0d879514a4.zip
fixups for previous OCAL tempfile wranglings
(bzr r4746)
Diffstat (limited to 'src')
-rw-r--r--src/ui/dialog/ocaldialogs.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/ui/dialog/ocaldialogs.cpp b/src/ui/dialog/ocaldialogs.cpp
index 0c20ffa43..dfeea700b 100644
--- a/src/ui/dialog/ocaldialogs.cpp
+++ b/src/ui/dialog/ocaldialogs.cpp
@@ -278,15 +278,20 @@ void FileListViewText::on_cursor_changed()
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));