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