]> git.lyx.org Git - lyx.git/commitdiff
* get rid of support::absolutePath()
authorAbdelrazak Younes <younes@lyx.org>
Mon, 17 Dec 2007 16:04:46 +0000 (16:04 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Mon, 17 Dec 2007 16:04:46 +0000 (16:04 +0000)
* remove FileName.h inclusion from filetools.h

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22188 a592a061-630c-0410-9148-cb99ea01b6c8

33 files changed:
src/CmdDef.cpp
src/EmbeddedFiles.cpp
src/KeyMap.cpp
src/LaTeX.cpp
src/LaTeXFeatures.cpp
src/Lexer.cpp
src/ModuleList.cpp
src/Mover.cpp
src/Session.cpp
src/TextClass.cpp
src/TextClassList.cpp
src/Trans.cpp
src/frontends/qt4/FileDialog.cpp
src/frontends/qt4/GuiRef.cpp
src/graphics/GraphicsCache.cpp
src/graphics/GraphicsCacheItem.cpp
src/graphics/GraphicsConverter.cpp
src/graphics/PreviewLoader.cpp
src/insets/ExternalSupport.cpp
src/insets/InsetBibtex.cpp
src/insets/InsetInclude.cpp
src/mathed/MathAutoCorrect.cpp
src/mathed/MathExtern.cpp
src/mathed/MathFactory.cpp
src/output.cpp
src/support/FileName.cpp
src/support/filetools.cpp
src/support/filetools.h
src/support/os_cygwin.cpp
src/support/os_unix.cpp
src/support/os_win32.cpp
src/tex2lyx/preamble.cpp
src/tex2lyx/text.cpp

index f7dbb71a0921a167a0efeaa488f6240505b44f5c..e1a0e0066a440ca24ded23873e0d8d18fdebb27d 100644 (file)
@@ -16,6 +16,7 @@
 #include "Lexer.h"
 
 #include "support/debug.h"
+#include "support/FileName.h"
 #include "support/filetools.h"
 #include "support/lstrings.h"
 
index 7604d5bc5f43bf8956786204d5d42600ce7b8caa..8927dffcad9c77a819deb06424f88bc027ca3eba 100644 (file)
@@ -343,7 +343,7 @@ string const EmbeddedFiles::getInzipName(string const & abs_filename, string con
        // if inzip_name is an absolute path, use filename only to avoid
        // leaking of filesystem information in inzip_name
        // The second case covers cases '../path/file' and '.'
-       if (absolutePath(inzip_name) || prefixIs(inzip_name, "."))
+       if (FileName(inzip_name).isAbsolute() || prefixIs(inzip_name, "."))
                inzip_name = onlyFilename(abs_filename);
        // if this name has been used...
        // use _1_name, _2_name etc
index 67384b5adffb43dfa7eef489ad830929fd8852b8..36d79a4cd5e6191d2d067311ee12d785dbe12f8f 100644 (file)
@@ -21,6 +21,7 @@
 #include "Lexer.h"
 
 #include "support/docstream.h"
+#include "support/FileName.h"
 #include "support/filetools.h"
 
 #include <fstream>
index efeb1469c1ba15fc45c44a263e8840d0f5287fe3..082872a57aee76c67458764ac828ce0c918af912 100644 (file)
@@ -22,8 +22,9 @@
 #include "support/debug.h"
 #include "DepTable.h"
 
-#include "support/filetools.h"
 #include "support/convert.h"
+#include "support/FileName.h"
+#include "support/filetools.h"
 #include "support/lstrings.h"
 #include "support/Systemcall.h"
 #include "support/os.h"
@@ -744,12 +745,12 @@ bool handleFoundFile(string const & ff, DepTable & head)
        // (1) foundfile is an
        //     absolute path and should
        //     be inserted.
-       if (absolutePath(foundfile)) {
+       FileName absname(foundfile);
+       if (absname.isAbsolute()) {
                LYXERR(Debug::DEPEND, "AbsolutePath file: " << foundfile);
                // On initial insert we want to do the update at once
                // since this file cannot be a file generated by
                // the latex run.
-               FileName absname(foundfile);
                if (!insertIfExists(absname, head)) {
                        // check for spaces
                        string strippedfile = foundfile;
@@ -772,7 +773,7 @@ bool handleFoundFile(string const & ff, DepTable & head)
        }
 
        string onlyfile = onlyFilename(foundfile);
-       FileName absname(makeAbsPath(onlyfile));
+       absname = makeAbsPath(onlyfile);
 
        // check for spaces
        while (contains(foundfile, ' ')) {
index 1b29d2206aef676b59878283f95d3d24b8ad3e7d..fdf353dba30291368ce4fd03e4976d2aee906737 100644 (file)
@@ -29,6 +29,7 @@
 #include "TextClass.h"
 
 #include "support/docstream.h"
+#include "support/FileName.h"
 #include "support/filetools.h"
 
 using namespace std;
index ad6f860c6f16dbf1cf0ae95491da8bbcea14e63a..3ad6c8f27bff4d076a9d8f924c57345ba167f931 100644 (file)
@@ -18,6 +18,7 @@
 #include "support/debug.h"
 
 #include "support/convert.h"
+#include "support/FileName.h"
 #include "support/filetools.h"
 #include "support/gzstream.h"
 #include "support/lstrings.h"
index 99d8b7e3941d126aa7789b0b218d553db9f01123..daa19da09d88ba8c595d97d70f330dde1c55214e 100644 (file)
@@ -16,6 +16,7 @@
 #include "support/debug.h"
 #include "Lexer.h"
 
+#include "support/FileName.h"
 #include "support/filetools.h"
 #include "support/lstrings.h"
 
index 9f1f0a06a12d5cc2b363f2a5302eb11c63283f77..81d13d2a5df4277aa5d674492fb5d10f146a0f48 100644 (file)
@@ -12,6 +12,7 @@
 
 #include "Mover.h"
 
+#include "support/FileName.h"
 #include "support/filetools.h"
 #include "support/lstrings.h"
 #include "support/Systemcall.h"
index a9b5e86f46af6ac30fcc457dbe85e6d8e9e23996..35498bdbb479524627174c49833b0b23603d055b 100644 (file)
@@ -55,11 +55,11 @@ void LastFilesSection::read(istream & is)
                if (c == '[')
                        break;
                getline(is, tmp);
-               if (tmp == "" || tmp[0] == '#' || tmp[0] == ' ' || !absolutePath(tmp))
+               FileName const file(tmp);
+               if (tmp == "" || tmp[0] == '#' || tmp[0] == ' ' || !file.isAbsolute())
                        continue;
 
                // read lastfiles
-               FileName const file(tmp);
                if (file.exists() && !file.isDirectory()
                    && lastfiles.size() < num_lastfiles)
                        lastfiles.push_back(file);
@@ -109,10 +109,10 @@ void LastOpenedSection::read(istream & is)
                if (c == '[')
                        break;
                getline(is, tmp);
-               if (tmp == "" || tmp[0] == '#' || tmp[0] == ' ' || !absolutePath(tmp))
+               FileName const file(tmp);
+               if (tmp == "" || tmp[0] == '#' || tmp[0] == ' ' || !file.isAbsolute())
                        continue;
 
-               FileName const file(tmp);
                if (file.exists() && !file.isDirectory())
                        lastopened.push_back(file);
                else
index e9c9cda5148709cf0e2530ce517b59891ae1ebf3..0c3ab8ba2e84ac6f494fc5d22c1b153bbdb5591d 100644 (file)
@@ -29,6 +29,7 @@
 #include "frontends/alert.h"
 
 #include "support/lstrings.h"
+#include "support/FileName.h"
 #include "support/filetools.h"
 #include "support/os.h"
 
index 42d294ff58d06ecfc73ea7425ce1f1b62e96997e..a696936f535380c5a9a77dbca4d8308801d76ddf 100644 (file)
@@ -16,6 +16,7 @@
 #include "support/debug.h"
 #include "Lexer.h"
 
+#include "support/FileName.h"
 #include "support/filetools.h"
 
 #include <boost/bind.hpp>
index d6f7ca1d675c3586c225efb72235ee4bb388ef24..ba01232ba751d5116ba169e2409f9823f4a81353 100644 (file)
@@ -22,6 +22,7 @@
 #include "LyXRC.h"
 #include "Text.h"
 
+#include "support/FileName.h"
 #include "support/filetools.h"
 #include "support/lstrings.h"
 #include "support/convert.h"
index 327e6ff243ab381028977ef949e88e55d3a2ae36..eb956cdf374aa05754f2ac20f8900786acb8d356 100644 (file)
@@ -17,9 +17,9 @@
 #include "qt_helpers.h"
 
 #include "support/debug.h"
-#include "support/gettext.h"
-
 #include "support/FileFilterList.h"
+#include "support/FileName.h"
+#include "support/gettext.h"
 #include "support/os.h"
 
 /** when this is defined, the code will use
index c696dc16e5a0a7cde39eb9d60f9b9d5e67df6ebc..6c3b554b680e4ce88b11575dda036c6085df9498 100644 (file)
@@ -21,6 +21,7 @@
 
 #include "insets/InsetRef.h"
 
+#include "support/FileName.h"
 #include "support/filetools.h" // MakeAbsPath, MakeDisplayPath
 
 #include <QLineEdit>
index f38188a566a3c649a1981d200ef7f98d22fcdd9c..89c5053cb6617e51511aa674524a9844fb6aa234 100644 (file)
@@ -16,7 +16,7 @@
 #include "GraphicsImage.h"
 
 #include "support/debug.h"
-
+#include "support/FileName.h"
 #include "support/filetools.h"
 
 #include <map>
index c4044e5d3fbc51369655d8f3c939d1aabddee772..2960ae6002d84484c244acb718edeb3b733d7bc6 100644 (file)
@@ -20,6 +20,7 @@
 #include "support/debug.h"
 #include "Format.h"
 
+#include "support/FileName.h"
 #include "support/filetools.h"
 #include "support/FileMonitor.h"
 
index 712b776f34635c5d81a294f38a0052265a00bed2..7c8991bebcf2f597218f9bf080a317bfbbb9ce5f 100644 (file)
@@ -17,6 +17,7 @@
 
 #include "support/convert.h"
 #include "support/debug.h"
+#include "support/FileName.h"
 #include "support/filetools.h"
 #include "support/ForkedCalls.h"
 #include "support/lstrings.h"
index a10b2c9f8dc5b6c11e284acad0cd5900f4af4e30..2f6206f1272fe52e978ade3e5ef0811bfa7167e9 100644 (file)
@@ -32,6 +32,7 @@
 
 #include "support/convert.h"
 #include "support/debug.h"
+#include "support/FileName.h"
 #include "support/filetools.h"
 #include "support/ForkedCalls.h"
 #include "support/lstrings.h"
index 368d57361b1bfca8d6d5df1156b53691a4b0dadb..0ce66a42e7a176346173f7bc8c67c42badd8d887 100644 (file)
@@ -130,7 +130,7 @@ string const doSubstitution(InsetExternalParams const & params,
                                    relToParentPath, use_latex_path,
                                    PROTECT_EXTENSION,
                                    ESCAPE_DOTS);
-               if (absolutePath(filename)) {
+               if (FileName(filename).isAbsolute()) {
                        result = subst_path(result, "$$AbsOrRelPathMaster",
                                            abspath, use_latex_path,
                                            PROTECT_EXTENSION,
index c60a30b2d5aa36fe7fc8fb41ab583762b68ce6b3..fed145068fc5b25c9809a4a1e5a8888bc2d6a601 100644 (file)
@@ -112,7 +112,7 @@ string normalizeName(Buffer const & buffer, OutputParams const & runparams,
                      string const & name, string const & ext)
 {
        string const fname = makeAbsPath(name, buffer.filePath()).absFilename();
-       if (absolutePath(name) || !FileName(fname + ext).isReadableFile())
+       if (FileName(name).isAbsolute() || !FileName(fname + ext).isReadableFile())
                return name;
        if (!runparams.nice)
                return fname;
index 7608c2eea7dea7fa337f6465beb18cf327e79da0..a3cb9c4d088cc28dd9ab627f1a8e2420ac000f56 100644 (file)
@@ -382,7 +382,7 @@ int InsetInclude::latex(Buffer const & buffer, odocstream & os,
 
        // if incfile is relative, make it relative to the master
        // buffer directory.
-       if (!absolutePath(incfile)) {
+       if (!FileName(incfile).isAbsolute()) {
                // FIXME UNICODE
                incfile = to_utf8(makeRelPath(from_utf8(included_file.absFilename()),
                                              from_utf8(masterBuffer->filePath())));
index 958a12652674226c7a5bbffb0e99541341f25313..d10929eaee7a4d16708640001ac75b7a0bc3be37 100644 (file)
@@ -17,6 +17,7 @@
 #include "MathParser.h"
 #include "support/debug.h"
 
+#include "support/FileName.h"
 #include "support/filetools.h" //  LibFileSearch
 #include "support/docstream.h"
 
index 1a6330d4aa07efa58bec04cf8015ed9d76b00155..42cfc311959c5f54f4eae15e6e476520e84c4761 100644 (file)
@@ -36,6 +36,7 @@
 #include "MathStream.h"
 
 #include "support/docstream.h"
+#include "support/FileName.h"
 #include "support/filetools.h"
 #include "support/lstrings.h"
 
index a3a77d1123d141ea9a7679d1df977f3fa2463ae5..a7d3ba0300a0e22d2a9f8d50115f272eba3d6485 100644 (file)
@@ -52,6 +52,7 @@
 #include "insets/InsetCommand.h"
 
 #include "support/docstream.h"
+#include "support/FileName.h"
 #include "support/filetools.h" // LibFileSearch
 #include "support/lstrings.h"
 
index 67b0323b491c22e79a1994d7dc41e31edf862c2b..6fb2fe373ecb082f53e0411eb280b5b33f30cde5 100644 (file)
@@ -16,6 +16,7 @@
 
 #include "frontends/alert.h"
 
+#include "support/FileName.h"
 #include "support/filetools.h"
 #include "support/lstrings.h"
 
index 1f7803dec4e61fca6b5800951c23bf9250dac145..780a4610fac618925fe75eb5ac8e79a3565d7084 100644 (file)
@@ -857,8 +857,9 @@ DocFileName::DocFileName(FileName const & abs_filename, bool save_abs)
 
 void DocFileName::set(string const & name, string const & buffer_path)
 {
-       save_abs_path_ = absolutePath(name);
-       FileName::set(save_abs_path_ ? name : makeAbsPath(name, buffer_path).absFilename());
+       FileName::set(name);
+       if (!isAbsolute())
+               FileName::set(makeAbsPath(name, buffer_path).absFilename());
        zipped_valid_ = false;
 }
 
index 421e016be5c191a81c64eb00a6a9c28e2db848d5..a7cf272e6ba3cce252bd6b368cbf1c7c18e8774b 100644 (file)
@@ -486,13 +486,6 @@ string const onlyFilename(string const & fname)
 }
 
 
-/// Returns true is path is absolute
-bool absolutePath(string const & path)
-{
-       return FileName(path).isAbsolute();
-}
-
-
 // Create absolute path. If impossible, don't do anything
 // Supports ./ and ~/. Later we can add support for ~logname/. (Asger)
 string const expandPath(string const & path)
index 2ea500a8aaa73858c28fc4343615f7004596f89f..d9609ef2db98a9ba73163455e23f726c98de2dc0 100644 (file)
@@ -13,7 +13,6 @@
 #define LYX_FILETOOL_H
 
 #include "support/docstring.h"
-#include "support/FileName.h"
 
 #include <utility>
 #include <string>
@@ -21,6 +20,8 @@
 namespace lyx {
 namespace support {
 
+class FileName;
+
 /// Creates the per buffer temporary directory
 std::string const createBufferTmpDir();
 
@@ -197,9 +198,6 @@ std::string const unzippedFileName(std::string const & zipped_file);
 FileName const unzipFile(FileName const & zipped_file,
                         std::string const & unzipped_file = std::string());
 
-/// Returns true is path is absolute
-bool absolutePath(std::string const & path);
-
 /// Create absolute path. If impossible, don't do anything
 std::string const expandPath(std::string const & path);
 
index b498272907e958d9c5cd44b6843007b2f655c26b..cfaeb549f6330277b3de6e5b0b2c50c06bdc3530 100644 (file)
@@ -16,6 +16,7 @@
 
 #include "support/os.h"
 
+#include "support/FileName.h"
 #include "support/lstrings.h"
 #include "support/debug.h"
 
index 84c00cfb1274310b7436dff087fd4ca537607a62..50701eaeb13b0c17539c2fc64f2bd50348949c24 100644 (file)
@@ -14,6 +14,7 @@
 
 #include "support/os.h"
 #include "support/docstring.h"
+#include "support/FileName.h"
 
 #ifdef __APPLE__
 #include <Carbon/Carbon.h>
index 6f89eafa79989c322f1b0e1eda35b1f1b42e61eb..329573fcbc0a9ba9b3845610c6cbf700340d24d1 100644 (file)
@@ -16,7 +16,9 @@
 
 #include "support/os.h"
 #include "support/os_win32.h"
+
 #include "support/debug.h"
+#include "support/FileName.h"
 #include "support/gettext.h"
 #include "support/filetools.h"
 #include "support/lstrings.h"
index 8a884713d528b4ce7a1bd93a9e870689c650e240..3fa21d87b331d04fbad97fd839353fcbf2bff448 100644 (file)
@@ -18,7 +18,9 @@
 #include "Layout.h"
 #include "Lexer.h"
 #include "TextClass.h"
+
 #include "support/convert.h"
+#include "support/FileName.h"
 #include "support/filetools.h"
 #include "support/lstrings.h"
 
index dd7cd54f7c221f5eb0e4c08ec360fdd7bf99b3f0..211fbb24e7c1f9e5e858ae7bf2f9cc3baaf84c96 100644 (file)
 #include "Layout.h"
 #include "Length.h"
 
-#include "support/lstrings.h"
 #include "support/convert.h"
+#include "support/FileName.h"
 #include "support/filetools.h"
+#include "support/lstrings.h"
 
 #include <iostream>
 #include <map>
@@ -1029,8 +1030,10 @@ string const normalize_filename(string const & name)
 /// convention (relative to .lyx file) if it is relative
 void fix_relative_filename(string & name)
 {
-       if (absolutePath(name))
+       FileName fname(name);
+       if (fname.isAbsolute())
                return;
+
        // FIXME UNICODE encoding of name may be wrong (makeAbsPath expects
        // utf8)
        name = to_utf8(makeRelPath(from_utf8(makeAbsPath(name, getMasterFilePath()).absFilename()),