From: Angus Leeming Date: Sat, 6 Jul 2002 12:50:09 +0000 (+0000) Subject: Store the temporary files in Buffer::tmppath. X-Git-Tag: 1.6.10~18960 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=156cb8ffdddc5301fc06003236f2014c4b9833fe;p=features.git Store the temporary files in Buffer::tmppath. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4541 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/graphics/ChangeLog b/src/graphics/ChangeLog index 4bb0077236..73b01d68f2 100644 --- a/src/graphics/ChangeLog +++ b/src/graphics/ChangeLog @@ -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 * PreviewImage.h: diff --git a/src/graphics/PreviewLoader.C b/src/graphics/PreviewLoader.C index d1b748f205..aff30840bc 100644 --- a/src/graphics/PreviewLoader.C +++ b/src/graphics/PreviewLoader.C @@ -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; }