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