#include "support/filetools.h"
#include "support/lassert.h"
#include "support/lstrings.h"
+#include "support/mutex.h"
#include "support/qstring_helpers.h"
#include "support/os.h"
#include "support/Package.h"
bool FileName::copyTo(FileName const & name, bool keepsymlink) const
{
FileNameSet visited;
- visited.insert(*this);
return copyTo(name, keepsymlink, visited);
}
{
LYXERR(Debug::FILES, "Copying " << name << " keep symlink: " << keepsymlink);
if (keepsymlink && name.isSymLink()) {
+ visited.insert(*this);
FileName const target(fromqstr(name.d->fi.symLinkTarget()));
if (visited.find(target) != visited.end()) {
LYXERR(Debug::FILES, "Found circular symlink: " << target);
string DocFileName::mangledFileName(string const & dir) const
{
- // FIXME THREAD
// Concurrent access to these variables is possible.
// We need to make sure that every DocFileName instance for a given
// filename returns the same mangled name.
typedef map<string, string> MangledMap;
static MangledMap mangledNames;
+ static Mutex mangledMutex;
+ // this locks both access to mangledNames and counter below
+ Mutex::Locker lock(&mangledMutex);
MangledMap::const_iterator const it = mangledNames.find(absFileName());
if (it != mangledNames.end())
return (*it).second;
// Add the extension back on
mname = support::changeExtension(mname, getExtension(name));
- // FIXME THREAD
// Prepend a counter to the filename. This is necessary to make
// the mangled name unique.
static int counter = 0;