]> git.lyx.org Git - lyx.git/blob - src/support/FileName.cpp
Try to remove the destination without first checking for its existence
[lyx.git] / src / support / FileName.cpp
1 /**
2  * \file FileName.cpp
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Angus Leeming
7  *
8  * Full author contact details are available in file CREDITS.
9  */
10
11 #include <config.h>
12
13 #include "support/FileName.h"
14 #include "support/FileNameList.h"
15
16 #include "support/debug.h"
17 #include "support/filetools.h"
18 #include "support/lstrings.h"
19 #include "support/lyxlib.h"
20 #include "support/os.h"
21 #include "support/qstring_helpers.h"
22
23 #include <QDateTime>
24 #include <QDir>
25 #include <QFile>
26 #include <QFileInfo>
27 #include <QList>
28 #include <QTime>
29
30 #include <boost/assert.hpp>
31
32 #include <map>
33 #include <sstream>
34 #include <fstream>
35 #include <algorithm>
36
37 #ifdef HAVE_SYS_TYPES_H
38 # include <sys/types.h>
39 #endif
40 #ifdef HAVE_SYS_STAT_H
41 # include <sys/stat.h>
42 #endif
43 #ifdef HAVE_UNISTD_H
44 # include <unistd.h>
45 #endif
46 #ifdef HAVE_DIRECT_H
47 # include <direct.h>
48 #endif
49 #ifdef _WIN32
50 # include <windows.h>
51 #endif
52
53 #include <fcntl.h>
54 #include <cerrno>
55
56 using namespace std;
57
58 namespace lyx {
59 namespace support {
60
61
62 /////////////////////////////////////////////////////////////////////
63 //
64 // FileName::Private
65 //
66 /////////////////////////////////////////////////////////////////////
67
68 struct FileName::Private
69 {
70         Private() {}
71
72         Private(string const & abs_filename) : fi(toqstr(abs_filename))
73         {
74                 fi.setCaching(fi.exists() ? true : false);
75         }
76         ///
77         QFileInfo fi;
78 };
79
80 /////////////////////////////////////////////////////////////////////
81 //
82 // FileName
83 //
84 /////////////////////////////////////////////////////////////////////
85
86
87 FileName::FileName() : d(new Private)
88 {
89 }
90
91
92 FileName::FileName(string const & abs_filename)
93         : d(abs_filename.empty() ? new Private : new Private(abs_filename))
94 {
95 }
96
97
98 FileName::~FileName()
99 {
100         delete d;
101 }
102
103
104 FileName::FileName(FileName const & rhs) : d(new Private)
105 {
106         d->fi = rhs.d->fi;
107 }
108
109
110 FileName & FileName::operator=(FileName const & rhs)
111 {
112         d->fi = rhs.d->fi;
113         return *this;
114 }
115
116
117 bool FileName::empty() const
118 {
119         return d->fi.absoluteFilePath().isEmpty();
120 }
121
122
123 string FileName::absFilename() const
124 {
125         return fromqstr(d->fi.absoluteFilePath());
126 }
127
128
129 void FileName::set(string const & name)
130 {
131         d->fi.setFile(toqstr(name));
132         BOOST_ASSERT(d->fi.isAbsolute());
133 }
134
135
136 void FileName::erase()
137 {
138         d->fi = QFileInfo();
139 }
140
141
142 bool FileName::copyTo(FileName const & name, bool overwrite) const
143 {
144         if (overwrite)
145                 QFile::remove(name.d->fi.absoluteFilePath());
146         bool success = QFile::copy(d->fi.absoluteFilePath(), name.d->fi.absoluteFilePath());
147         if (!success)
148                 lyxerr << "FileName::copyTo(): Could not copy file "
149                         << *this << " to " << name << endl;
150         return success;
151 }
152
153
154 bool FileName::renameTo(FileName const & name) const
155 {
156         bool success = QFile::rename(d->fi.absoluteFilePath(), name.d->fi.absoluteFilePath());
157         if (!success)
158                 LYXERR0("Could not rename file " << *this << " to " << name);
159         return success;
160 }
161
162
163 bool FileName::moveTo(FileName const & name) const
164 {
165         QFile::remove(name.d->fi.absoluteFilePath());
166
167         bool success = QFile::rename(d->fi.absoluteFilePath(),
168                 name.d->fi.absoluteFilePath());
169         if (!success)
170                 LYXERR0("Could not move file " << *this << " to " << name);
171         return success;
172 }
173
174
175 bool FileName::changePermission(unsigned long int mode) const
176 {
177         if (!isWritable()) {
178                 LYXERR0("File " << *this << " is not writable!");
179                 return false;
180         }
181
182 #if defined (HAVE_CHMOD) && defined (HAVE_MODE_T)
183         if (::chmod(toFilesystemEncoding().c_str(), mode_t(mode)) != 0) {
184                 LYXERR0("File " << *this << ": cannot change permission to "
185                         << mode << ".");
186                 return false;
187         }
188 #endif
189         return true;
190 }
191
192
193 string FileName::toFilesystemEncoding() const
194 {
195         QByteArray const encoded = QFile::encodeName(d->fi.absoluteFilePath());
196         return string(encoded.begin(), encoded.end());
197 }
198
199
200 FileName FileName::fromFilesystemEncoding(string const & name)
201 {
202         QByteArray const encoded(name.c_str(), name.length());
203         return FileName(fromqstr(QFile::decodeName(encoded)));
204 }
205
206
207 bool FileName::exists() const
208 {
209         return d->fi.exists();
210 }
211
212
213 bool FileName::isSymLink() const
214 {
215         return d->fi.isSymLink();
216 }
217
218
219 bool FileName::isFileEmpty() const
220 {
221         return d->fi.size() == 0;
222 }
223
224
225 bool FileName::isDirectory() const
226 {
227         return d->fi.isDir();
228 }
229
230
231 bool FileName::isReadOnly() const
232 {
233         return d->fi.isReadable() && !d->fi.isWritable();
234 }
235
236
237 bool FileName::isReadableDirectory() const
238 {
239         return d->fi.isDir() && d->fi.isReadable();
240 }
241
242
243 string FileName::onlyFileName() const
244 {
245         return support::onlyFilename(absFilename());
246 }
247
248
249 FileName FileName::onlyPath() const
250 {
251         return FileName(support::onlyPath(absFilename()));
252 }
253
254
255 bool FileName::isReadableFile() const
256 {
257         return d->fi.isFile() && d->fi.isReadable();
258 }
259
260
261 bool FileName::isWritable() const
262 {
263         return d->fi.isWritable();
264 }
265
266
267 bool FileName::isDirWritable() const
268 {
269         LYXERR(Debug::FILES, "isDirWriteable: " << *this);
270
271         FileName const tmpfl(tempName(*this, "lyxwritetest"));
272
273         if (tmpfl.empty())
274                 return false;
275
276         tmpfl.removeFile();
277         return true;
278 }
279
280
281 FileNameList FileName::dirList(string const & ext) const
282 {
283         FileNameList dirlist;
284         if (!isDirectory()) {
285                 LYXERR0("Directory '" << *this << "' does not exist!");
286                 return dirlist;
287         }
288
289         QDir dir = d->fi.absoluteDir();
290
291         if (!ext.empty()) {
292                 QString filter;
293                 switch (ext[0]) {
294                 case '.': filter = "*" + toqstr(ext); break;
295                 case '*': filter = toqstr(ext); break;
296                 default: filter = "*." + toqstr(ext);
297                 }
298                 dir.setNameFilters(QStringList(filter));
299                 LYXERR(Debug::FILES, "filtering on extension "
300                         << fromqstr(filter) << " is requested.");
301         }
302
303         QFileInfoList list = dir.entryInfoList();
304         for (int i = 0; i != list.size(); ++i) {
305                 FileName fi(fromqstr(list.at(i).absoluteFilePath()));
306                 dirlist.push_back(fi);
307                 LYXERR(Debug::FILES, "found file " << fi);
308         }
309
310         return dirlist;
311 }
312
313
314 FileName FileName::tempName(FileName const & dir, string const & mask)
315 {
316         return support::tempName(dir, mask);
317 }
318
319
320 time_t FileName::lastModified() const
321 {
322         return d->fi.lastModified().toTime_t();
323 }
324
325
326 bool FileName::chdir() const
327 {
328         return QDir::setCurrent(d->fi.absoluteFilePath());
329 }
330
331
332 extern unsigned long sum(char const * file);
333
334 unsigned long FileName::checksum() const
335 {
336         if (!exists()) {
337                 LYXERR0("File \"" << absFilename() << "\" does not exist!");
338                 return 0;
339         }
340         // a directory may be passed here so we need to test it. (bug 3622)
341         if (isDirectory()) {
342                 LYXERR0('"' << absFilename() << "\" is a directory!");
343                 return 0;
344         }
345         if (!lyxerr.debugging(Debug::FILES))
346                 return sum(absFilename().c_str());
347
348         QTime t;
349         t.start();
350         unsigned long r = sum(absFilename().c_str());
351         lyxerr << "Checksumming \"" << absFilename() << "\" lasted "
352                 << t.elapsed() << " ms." << endl;
353         return r;
354 }
355
356
357 bool FileName::removeFile() const
358 {
359         bool const success = QFile::remove(d->fi.absoluteFilePath());
360         if (!success && exists())
361                 LYXERR0("Could not delete file " << *this);
362         return success;
363 }
364
365
366 static bool rmdir(QFileInfo const & fi)
367 {
368         QDir dir(fi.absoluteFilePath());
369         QFileInfoList list = dir.entryInfoList();
370         bool success = true;
371         for (int i = 0; i != list.size(); ++i) {
372                 if (list.at(i).fileName() == ".")
373                         continue;
374                 if (list.at(i).fileName() == "..")
375                         continue;
376                 bool removed;
377                 if (list.at(i).isDir()) {
378                         LYXERR(Debug::FILES, "Removing dir " 
379                                 << fromqstr(list.at(i).absoluteFilePath()));
380                         removed = rmdir(list.at(i));
381                 }
382                 else {
383                         LYXERR(Debug::FILES, "Removing file " 
384                                 << fromqstr(list.at(i).absoluteFilePath()));
385                         removed = dir.remove(list.at(i).fileName());
386                 }
387                 if (!removed) {
388                         success = false;
389                         LYXERR0("Could not delete "
390                                 << fromqstr(list.at(i).absoluteFilePath()));
391                 }
392         } 
393         QDir parent = fi.absolutePath();
394         success &= parent.rmdir(fi.fileName());
395         return success;
396 }
397
398
399 bool FileName::destroyDirectory() const
400 {
401         bool const success = rmdir(d->fi);
402         if (!success)
403                 LYXERR0("Could not delete " << *this);
404
405         return success;
406 }
407
408
409 static int mymkdir(char const * pathname, unsigned long int mode)
410 {
411         // FIXME: why don't we have mode_t in lyx::mkdir prototype ??
412 #if HAVE_MKDIR
413 # if MKDIR_TAKES_ONE_ARG
414         // MinGW32
415         return ::mkdir(pathname);
416         // FIXME: "Permissions of created directories are ignored on this system."
417 # else
418         // POSIX
419         return ::mkdir(pathname, mode_t(mode));
420 # endif
421 #elif defined(_WIN32)
422         // plain Windows 32
423         return CreateDirectory(pathname, 0) != 0 ? 0 : -1;
424         // FIXME: "Permissions of created directories are ignored on this system."
425 #elif HAVE__MKDIR
426         return ::_mkdir(pathname);
427         // FIXME: "Permissions of created directories are ignored on this system."
428 #else
429 #   error "Don't know how to create a directory on this system."
430 #endif
431
432 }
433
434
435 bool FileName::createDirectory(int permission) const
436 {
437         BOOST_ASSERT(!empty());
438         return mymkdir(toFilesystemEncoding().c_str(), permission) == 0;
439 }
440
441
442 bool FileName::createPath() const
443 {
444         BOOST_ASSERT(!empty());
445         if (isDirectory())
446                 return true;
447
448         QDir dir;
449         bool success = dir.mkpath(d->fi.absoluteFilePath());
450         if (!success)
451                 LYXERR0("Cannot create path '" << *this << "'!");
452         return success;
453 }
454
455
456 docstring const FileName::absoluteFilePath() const
457 {
458         return qstring_to_ucs4(d->fi.absoluteFilePath());
459 }
460
461
462 docstring FileName::displayName(int threshold) const
463 {
464         return makeDisplayPath(absFilename(), threshold);
465 }
466
467
468 docstring FileName::fileContents(string const & encoding) const
469 {
470         if (!isReadableFile()) {
471                 LYXERR0("File '" << *this << "' is not redable!");
472                 return docstring();
473         }
474
475         QFile file(d->fi.absoluteFilePath());
476         if (!file.open(QIODevice::ReadOnly)) {
477                 LYXERR0("File '" << *this
478                         << "' could not be opened in read only mode!");
479                 return docstring();
480         }
481         QByteArray contents = file.readAll();
482         file.close();
483
484         if (contents.isEmpty()) {
485                 LYXERR(Debug::FILES, "File '" << *this
486                         << "' is either empty or some error happened while reading it.");
487                 return docstring();
488         }
489
490         QString s;
491         if (encoding.empty() || encoding == "UTF-8")
492                 s = QString::fromUtf8(contents.data());
493         else if (encoding == "ascii")
494                 s = QString::fromAscii(contents.data());
495         else if (encoding == "local8bit")
496                 s = QString::fromLocal8Bit(contents.data());
497         else if (encoding == "latin1")
498                 s = QString::fromLatin1(contents.data());
499
500         return qstring_to_ucs4(s);
501 }
502
503
504 void FileName::changeExtension(string const & extension)
505 {
506         // FIXME: use Qt native methods...
507         string const oldname = absFilename();
508         string::size_type const last_slash = oldname.rfind('/');
509         string::size_type last_dot = oldname.rfind('.');
510         if (last_dot < last_slash && last_slash != string::npos)
511                 last_dot = string::npos;
512
513         string ext;
514         // Make sure the extension starts with a dot
515         if (!extension.empty() && extension[0] != '.')
516                 ext= '.' + extension;
517         else
518                 ext = extension;
519
520         set(oldname.substr(0, last_dot) + ext);
521 }
522
523
524 string FileName::guessFormatFromContents() const
525 {
526         // the different filetypes and what they contain in one of the first lines
527         // (dots are any characters).           (Herbert 20020131)
528         // AGR  Grace...
529         // BMP  BM...
530         // EPS  %!PS-Adobe-3.0 EPSF...
531         // FIG  #FIG...
532         // FITS ...BITPIX...
533         // GIF  GIF...
534         // JPG  JFIF
535         // PDF  %PDF-...
536         // PNG  .PNG...
537         // PBM  P1... or P4     (B/W)
538         // PGM  P2... or P5     (Grayscale)
539         // PPM  P3... or P6     (color)
540         // PS   %!PS-Adobe-2.0 or 1.0,  no "EPSF"!
541         // SGI  \001\332...     (decimal 474)
542         // TGIF %TGIF...
543         // TIFF II... or MM...
544         // XBM  ..._bits[]...
545         // XPM  /* XPM */    sometimes missing (f.ex. tgif-export)
546         //      ...static char *...
547         // XWD  \000\000\000\151        (0x00006900) decimal 105
548         //
549         // GZIP \037\213        http://www.ietf.org/rfc/rfc1952.txt
550         // ZIP  PK...                   http://www.halyava.ru/document/ind_arch.htm
551         // Z    \037\235                UNIX compress
552
553         // paranoia check
554         if (empty() || !isReadableFile())
555                 return string();
556
557         ifstream ifs(toFilesystemEncoding().c_str());
558         if (!ifs)
559                 // Couldn't open file...
560                 return string();
561
562         // gnuzip
563         static string const gzipStamp = "\037\213";
564
565         // PKZIP
566         static string const zipStamp = "PK";
567
568         // compress
569         static string const compressStamp = "\037\235";
570
571         // Maximum strings to read
572         int const max_count = 50;
573         int count = 0;
574
575         string str;
576         string format;
577         bool firstLine = true;
578         while ((count++ < max_count) && format.empty()) {
579                 if (ifs.eof()) {
580                         LYXERR(Debug::GRAPHICS, "filetools(getFormatFromContents)\n"
581                                 << "\tFile type not recognised before EOF!");
582                         break;
583                 }
584
585                 getline(ifs, str);
586                 string const stamp = str.substr(0, 2);
587                 if (firstLine && str.size() >= 2) {
588                         // at first we check for a zipped file, because this
589                         // information is saved in the first bytes of the file!
590                         // also some graphic formats which save the information
591                         // in the first line, too.
592                         if (prefixIs(str, gzipStamp)) {
593                                 format =  "gzip";
594
595                         } else if (stamp == zipStamp) {
596                                 format =  "zip";
597
598                         } else if (stamp == compressStamp) {
599                                 format =  "compress";
600
601                         // the graphics part
602                         } else if (stamp == "BM") {
603                                 format =  "bmp";
604
605                         } else if (stamp == "\001\332") {
606                                 format =  "sgi";
607
608                         // PBM family
609                         // Don't need to use str.at(0), str.at(1) because
610                         // we already know that str.size() >= 2
611                         } else if (str[0] == 'P') {
612                                 switch (str[1]) {
613                                 case '1':
614                                 case '4':
615                                         format =  "pbm";
616                                     break;
617                                 case '2':
618                                 case '5':
619                                         format =  "pgm";
620                                     break;
621                                 case '3':
622                                 case '6':
623                                         format =  "ppm";
624                                 }
625                                 break;
626
627                         } else if ((stamp == "II") || (stamp == "MM")) {
628                                 format =  "tiff";
629
630                         } else if (prefixIs(str,"%TGIF")) {
631                                 format =  "tgif";
632
633                         } else if (prefixIs(str,"#FIG")) {
634                                 format =  "fig";
635
636                         } else if (prefixIs(str,"GIF")) {
637                                 format =  "gif";
638
639                         } else if (str.size() > 3) {
640                                 int const c = ((str[0] << 24) & (str[1] << 16) &
641                                                (str[2] << 8)  & str[3]);
642                                 if (c == 105) {
643                                         format =  "xwd";
644                                 }
645                         }
646
647                         firstLine = false;
648                 }
649
650                 if (!format.empty())
651                     break;
652                 else if (contains(str,"EPSF"))
653                         // dummy, if we have wrong file description like
654                         // %!PS-Adobe-2.0EPSF"
655                         format = "eps";
656
657                 else if (contains(str, "Grace"))
658                         format = "agr";
659
660                 else if (contains(str, "JFIF"))
661                         format = "jpg";
662
663                 else if (contains(str, "%PDF"))
664                         format = "pdf";
665
666                 else if (contains(str, "PNG"))
667                         format = "png";
668
669                 else if (contains(str, "%!PS-Adobe")) {
670                         // eps or ps
671                         ifs >> str;
672                         if (contains(str,"EPSF"))
673                                 format = "eps";
674                         else
675                             format = "ps";
676                 }
677
678                 else if (contains(str, "_bits[]"))
679                         format = "xbm";
680
681                 else if (contains(str, "XPM") || contains(str, "static char *"))
682                         format = "xpm";
683
684                 else if (contains(str, "BITPIX"))
685                         format = "fits";
686         }
687
688         if (!format.empty()) {
689                 LYXERR(Debug::GRAPHICS, "Recognised Fileformat: " << format);
690                 return format;
691         }
692
693         LYXERR(Debug::GRAPHICS, "filetools(getFormatFromContents)\n"
694                 << "\tCouldn't find a known format!");
695         return string();
696 }
697
698
699 bool FileName::isZippedFile() const
700 {
701         string const type = guessFormatFromContents();
702         return contains("gzip zip compress", type) && !type.empty();
703 }
704
705
706 docstring const FileName::relPath(string const & path) const
707 {
708         // FIXME UNICODE
709         return makeRelPath(absoluteFilePath(), from_utf8(path));
710 }
711
712
713 bool operator==(FileName const & lhs, FileName const & rhs)
714 {
715         return lhs.absFilename() == rhs.absFilename();
716 }
717
718
719 bool operator!=(FileName const & lhs, FileName const & rhs)
720 {
721         return lhs.absFilename() != rhs.absFilename();
722 }
723
724
725 bool operator<(FileName const & lhs, FileName const & rhs)
726 {
727         return lhs.absFilename() < rhs.absFilename();
728 }
729
730
731 bool operator>(FileName const & lhs, FileName const & rhs)
732 {
733         return lhs.absFilename() > rhs.absFilename();
734 }
735
736
737 ostream & operator<<(ostream & os, FileName const & filename)
738 {
739         return os << filename.absFilename();
740 }
741
742
743 /////////////////////////////////////////////////////////////////////
744 //
745 // DocFileName
746 //
747 /////////////////////////////////////////////////////////////////////
748
749
750 DocFileName::DocFileName()
751         : save_abs_path_(true)
752 {}
753
754
755 DocFileName::DocFileName(string const & abs_filename, bool save_abs)
756         : FileName(abs_filename), save_abs_path_(save_abs), zipped_valid_(false)
757 {}
758
759
760 DocFileName::DocFileName(FileName const & abs_filename, bool save_abs)
761         : FileName(abs_filename), save_abs_path_(save_abs), zipped_valid_(false)
762 {}
763
764
765 void DocFileName::set(string const & name, string const & buffer_path)
766 {
767         save_abs_path_ = absolutePath(name);
768         FileName::set(save_abs_path_ ? name : makeAbsPath(name, buffer_path).absFilename());
769         zipped_valid_ = false;
770 }
771
772
773 void DocFileName::erase()
774 {
775         FileName::erase();
776         zipped_valid_ = false;
777 }
778
779
780 string DocFileName::relFilename(string const & path) const
781 {
782         // FIXME UNICODE
783         return to_utf8(relPath(path));
784 }
785
786
787 string DocFileName::outputFilename(string const & path) const
788 {
789         return save_abs_path_ ? absFilename() : relFilename(path);
790 }
791
792
793 string DocFileName::mangledFilename(string const & dir) const
794 {
795         // We need to make sure that every DocFileName instance for a given
796         // filename returns the same mangled name.
797         typedef map<string, string> MangledMap;
798         static MangledMap mangledNames;
799         MangledMap::const_iterator const it = mangledNames.find(absFilename());
800         if (it != mangledNames.end())
801                 return (*it).second;
802
803         string const name = absFilename();
804         // Now the real work
805         string mname = os::internal_path(name);
806         // Remove the extension.
807         mname = support::changeExtension(name, string());
808         // The mangled name must be a valid LaTeX name.
809         // The list of characters to keep is probably over-restrictive,
810         // but it is not really a problem.
811         // Apart from non-ASCII characters, at least the following characters
812         // are forbidden: '/', '.', ' ', and ':'.
813         // On windows it is not possible to create files with '<', '>' or '?'
814         // in the name.
815         static string const keep = "abcdefghijklmnopqrstuvwxyz"
816                                    "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
817                                    "+,-0123456789;=";
818         string::size_type pos = 0;
819         while ((pos = mname.find_first_not_of(keep, pos)) != string::npos)
820                 mname[pos++] = '_';
821         // Add the extension back on
822         mname = support::changeExtension(mname, getExtension(name));
823
824         // Prepend a counter to the filename. This is necessary to make
825         // the mangled name unique.
826         static int counter = 0;
827         ostringstream s;
828         s << counter++ << mname;
829         mname = s.str();
830
831         // MiKTeX's YAP (version 2.4.1803) crashes if the file name
832         // is longer than about 160 characters. MiKTeX's pdflatex
833         // is even pickier. A maximum length of 100 has been proven to work.
834         // If dir.size() > max length, all bets are off for YAP. We truncate
835         // the filename nevertheless, keeping a minimum of 10 chars.
836
837         string::size_type max_length = max(100 - ((int)dir.size() + 1), 10);
838
839         // If the mangled file name is too long, hack it to fit.
840         // We know we're guaranteed to have a unique file name because
841         // of the counter.
842         if (mname.size() > max_length) {
843                 int const half = (int(max_length) / 2) - 2;
844                 if (half > 0) {
845                         mname = mname.substr(0, half) + "___" +
846                                 mname.substr(mname.size() - half);
847                 }
848         }
849
850         mangledNames[absFilename()] = mname;
851         return mname;
852 }
853
854
855 bool DocFileName::isZipped() const
856 {
857         if (!zipped_valid_) {
858                 zipped_ = isZippedFile();
859                 zipped_valid_ = true;
860         }
861         return zipped_;
862 }
863
864
865 string DocFileName::unzippedFilename() const
866 {
867         return unzippedFileName(absFilename());
868 }
869
870
871 bool operator==(DocFileName const & lhs, DocFileName const & rhs)
872 {
873         return lhs.absFilename() == rhs.absFilename()
874                 && lhs.saveAbsPath() == rhs.saveAbsPath();
875 }
876
877
878 bool operator!=(DocFileName const & lhs, DocFileName const & rhs)
879 {
880         return !(lhs == rhs);
881 }
882
883 } // namespace support
884 } // namespace lyx