]> git.lyx.org Git - features.git/commitdiff
Store the temporary files in Buffer::tmppath.
authorAngus Leeming <leeming@lyx.org>
Sat, 6 Jul 2002 12:50:09 +0000 (12:50 +0000)
committerAngus Leeming <leeming@lyx.org>
Sat, 6 Jul 2002 12:50:09 +0000 (12:50 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4541 a592a061-630c-0410-9148-cb99ea01b6c8

src/graphics/ChangeLog
src/graphics/PreviewLoader.C

index 4bb00772362c79942da3099832ff02bc7e54c557..73b01d68f284e9145ba95ece32d02ae63f9f7b4a 100644 (file)
@@ -8,6 +8,8 @@
        exist (perhaps because the process was curtailed before the images
        were loaded.)
 
+       * PreviewLoader.C (unique_filename): store the files in Buffer::tmppath.
+
 2002-07-05  Angus Leeming  <leeming@lyx.org>
 
        * PreviewImage.h:
index d1b748f205f309fc85c3154b2747f90c544d31b7..aff30840bc7a5f407becd23fce3fe129f89c7109 100644 (file)
@@ -74,21 +74,11 @@ private:
 };
 
 
-string const unique_filename()
+string const unique_filename(string const bufferpath)
 {
-       
-       static string dir;
-       if (dir.empty()) {
-               string const tmp = lyx::tempName();
-               lyx::unlink(tmp);
-               dir = OnlyPath(tmp);
-       }
-
        static int theCounter = 0;
-       ostringstream os;
-       os << dir << theCounter++ << "lyxpreview";
-
-       return os.str().c_str();
+       string const filename = tostr(theCounter++) + "lyxpreview";
+       return AddName(bufferpath, filename);ostringstream os;
 }
 
 } // namespace anon
@@ -260,7 +250,7 @@ void PreviewLoader::Impl::setConverter()
 
 
 PreviewLoader::Impl::Impl(PreviewLoader & p, Buffer const & b)
-       : filename_base_(unique_filename()), parent_(p), buffer_(b)
+       : filename_base_(unique_filename(b.tmppath)), parent_(p), buffer_(b)
 {}
 
 
@@ -411,7 +401,7 @@ void PreviewLoader::Impl::startLoading()
        // Reset the filename and clear pending_, so we're ready to
        // start afresh.
        pending_.clear();
-       filename_base_ = unique_filename();
+       filename_base_ = unique_filename(buffer_.tmppath);
 
        // The conversion command.
        ostringstream cs;
@@ -437,8 +427,7 @@ void PreviewLoader::Impl::startLoading()
                return;
        }
        
-       // Store the generation process in a list of all generating processes
-       // (I anticipate that this will be small!)
+       // Store the generation process in a list of all such processes
        inprogress.pid = call.pid();
        in_progress_[command] = inprogress;
 }