#include "Lexer.h"
#include "support/debug.h"
+#include "support/FileName.h"
#include "support/filetools.h"
#include "support/lstrings.h"
// 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
#include "Lexer.h"
#include "support/docstream.h"
+#include "support/FileName.h"
#include "support/filetools.h"
#include <fstream>
#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"
// (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;
}
string onlyfile = onlyFilename(foundfile);
- FileName absname(makeAbsPath(onlyfile));
+ absname = makeAbsPath(onlyfile);
// check for spaces
while (contains(foundfile, ' ')) {
#include "TextClass.h"
#include "support/docstream.h"
+#include "support/FileName.h"
#include "support/filetools.h"
using namespace std;
#include "support/debug.h"
#include "support/convert.h"
+#include "support/FileName.h"
#include "support/filetools.h"
#include "support/gzstream.h"
#include "support/lstrings.h"
#include "support/debug.h"
#include "Lexer.h"
+#include "support/FileName.h"
#include "support/filetools.h"
#include "support/lstrings.h"
#include "Mover.h"
+#include "support/FileName.h"
#include "support/filetools.h"
#include "support/lstrings.h"
#include "support/Systemcall.h"
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);
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
#include "frontends/alert.h"
#include "support/lstrings.h"
+#include "support/FileName.h"
#include "support/filetools.h"
#include "support/os.h"
#include "support/debug.h"
#include "Lexer.h"
+#include "support/FileName.h"
#include "support/filetools.h"
#include <boost/bind.hpp>
#include "LyXRC.h"
#include "Text.h"
+#include "support/FileName.h"
#include "support/filetools.h"
#include "support/lstrings.h"
#include "support/convert.h"
#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
#include "insets/InsetRef.h"
+#include "support/FileName.h"
#include "support/filetools.h" // MakeAbsPath, MakeDisplayPath
#include <QLineEdit>
#include "GraphicsImage.h"
#include "support/debug.h"
-
+#include "support/FileName.h"
#include "support/filetools.h"
#include <map>
#include "support/debug.h"
#include "Format.h"
+#include "support/FileName.h"
#include "support/filetools.h"
#include "support/FileMonitor.h"
#include "support/convert.h"
#include "support/debug.h"
+#include "support/FileName.h"
#include "support/filetools.h"
#include "support/ForkedCalls.h"
#include "support/lstrings.h"
#include "support/convert.h"
#include "support/debug.h"
+#include "support/FileName.h"
#include "support/filetools.h"
#include "support/ForkedCalls.h"
#include "support/lstrings.h"
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,
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;
// 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())));
#include "MathParser.h"
#include "support/debug.h"
+#include "support/FileName.h"
#include "support/filetools.h" // LibFileSearch
#include "support/docstream.h"
#include "MathStream.h"
#include "support/docstream.h"
+#include "support/FileName.h"
#include "support/filetools.h"
#include "support/lstrings.h"
#include "insets/InsetCommand.h"
#include "support/docstream.h"
+#include "support/FileName.h"
#include "support/filetools.h" // LibFileSearch
#include "support/lstrings.h"
#include "frontends/alert.h"
+#include "support/FileName.h"
#include "support/filetools.h"
#include "support/lstrings.h"
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;
}
}
-/// 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)
#define LYX_FILETOOL_H
#include "support/docstring.h"
-#include "support/FileName.h"
#include <utility>
#include <string>
namespace lyx {
namespace support {
+class FileName;
+
/// Creates the per buffer temporary directory
std::string const createBufferTmpDir();
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);
#include "support/os.h"
+#include "support/FileName.h"
#include "support/lstrings.h"
#include "support/debug.h"
#include "support/os.h"
#include "support/docstring.h"
+#include "support/FileName.h"
#ifdef __APPLE__
#include <Carbon/Carbon.h>
#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"
#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"
#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>
/// 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()),