mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-26 18:42:41 +01:00
SF# 3178098
This commit is contained in:
@@ -16,14 +16,14 @@
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
@@ -52,7 +52,7 @@ public:
|
||||
TempFileCollector()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
~TempFileCollector()
|
||||
{
|
||||
for (std::set<std::string>::iterator it = _files.begin(); it != _files.end(); ++it)
|
||||
@@ -68,7 +68,7 @@ public:
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void registerFile(const std::string& path)
|
||||
{
|
||||
FastMutex::ScopedLock lock(_mutex);
|
||||
@@ -76,7 +76,7 @@ public:
|
||||
Path p(path);
|
||||
_files.insert(p.absolute().toString());
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
std::set<std::string> _files;
|
||||
FastMutex _mutex;
|
||||
@@ -88,6 +88,11 @@ TemporaryFile::TemporaryFile(): File(tempName()), _keep(false)
|
||||
}
|
||||
|
||||
|
||||
TemporaryFile::TemporaryFile(const std::string& tempDir): File(tempName(tempDir)), _keep(false)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
TemporaryFile::~TemporaryFile()
|
||||
{
|
||||
if (!_keep)
|
||||
@@ -109,7 +114,7 @@ void TemporaryFile::keep()
|
||||
_keep = true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void TemporaryFile::keepUntilExit()
|
||||
{
|
||||
_keep = true;
|
||||
@@ -124,7 +129,7 @@ void TemporaryFile::registerForDeletion(const std::string& path)
|
||||
}
|
||||
|
||||
|
||||
std::string TemporaryFile::tempName()
|
||||
std::string TemporaryFile::tempName(const std::string& tempDir)
|
||||
{
|
||||
std::ostringstream name;
|
||||
static FastMutex mutex;
|
||||
@@ -132,7 +137,7 @@ std::string TemporaryFile::tempName()
|
||||
mutex.lock();
|
||||
unsigned long n = count++;
|
||||
mutex.unlock();
|
||||
name << Path::temp();
|
||||
name << (tempDir.empty() ? Path::temp() : tempDir);
|
||||
name << "tmp" << Process::id();
|
||||
for (int i = 0; i < 6; ++i)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user