mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 13:18:28 +00:00
* get rid of support::absolutePath()
* remove FileName.h inclusion from filetools.h git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22188 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
96ee270933
commit
9439b6e6e0
@ -16,6 +16,7 @@
|
||||
#include "Lexer.h"
|
||||
|
||||
#include "support/debug.h"
|
||||
#include "support/FileName.h"
|
||||
#include "support/filetools.h"
|
||||
#include "support/lstrings.h"
|
||||
|
||||
|
@ -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
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "Lexer.h"
|
||||
|
||||
#include "support/docstream.h"
|
||||
#include "support/FileName.h"
|
||||
#include "support/filetools.h"
|
||||
|
||||
#include <fstream>
|
||||
|
@ -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, ' ')) {
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include "TextClass.h"
|
||||
|
||||
#include "support/docstream.h"
|
||||
#include "support/FileName.h"
|
||||
#include "support/filetools.h"
|
||||
|
||||
using namespace std;
|
||||
|
@ -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"
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "support/debug.h"
|
||||
#include "Lexer.h"
|
||||
|
||||
#include "support/FileName.h"
|
||||
#include "support/filetools.h"
|
||||
#include "support/lstrings.h"
|
||||
|
||||
|
@ -12,6 +12,7 @@
|
||||
|
||||
#include "Mover.h"
|
||||
|
||||
#include "support/FileName.h"
|
||||
#include "support/filetools.h"
|
||||
#include "support/lstrings.h"
|
||||
#include "support/Systemcall.h"
|
||||
|
@ -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
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include "frontends/alert.h"
|
||||
|
||||
#include "support/lstrings.h"
|
||||
#include "support/FileName.h"
|
||||
#include "support/filetools.h"
|
||||
#include "support/os.h"
|
||||
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "support/debug.h"
|
||||
#include "Lexer.h"
|
||||
|
||||
#include "support/FileName.h"
|
||||
#include "support/filetools.h"
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
|
@ -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"
|
||||
|
@ -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
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
#include "insets/InsetRef.h"
|
||||
|
||||
#include "support/FileName.h"
|
||||
#include "support/filetools.h" // MakeAbsPath, MakeDisplayPath
|
||||
|
||||
#include <QLineEdit>
|
||||
|
@ -16,7 +16,7 @@
|
||||
#include "GraphicsImage.h"
|
||||
|
||||
#include "support/debug.h"
|
||||
|
||||
#include "support/FileName.h"
|
||||
#include "support/filetools.h"
|
||||
|
||||
#include <map>
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "support/debug.h"
|
||||
#include "Format.h"
|
||||
|
||||
#include "support/FileName.h"
|
||||
#include "support/filetools.h"
|
||||
#include "support/FileMonitor.h"
|
||||
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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,
|
||||
|
@ -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;
|
||||
|
@ -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())));
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include "MathParser.h"
|
||||
#include "support/debug.h"
|
||||
|
||||
#include "support/FileName.h"
|
||||
#include "support/filetools.h" // LibFileSearch
|
||||
#include "support/docstream.h"
|
||||
|
||||
|
@ -36,6 +36,7 @@
|
||||
#include "MathStream.h"
|
||||
|
||||
#include "support/docstream.h"
|
||||
#include "support/FileName.h"
|
||||
#include "support/filetools.h"
|
||||
#include "support/lstrings.h"
|
||||
|
||||
|
@ -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"
|
||||
|
||||
|
@ -16,6 +16,7 @@
|
||||
|
||||
#include "frontends/alert.h"
|
||||
|
||||
#include "support/FileName.h"
|
||||
#include "support/filetools.h"
|
||||
#include "support/lstrings.h"
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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);
|
||||
|
||||
|
@ -16,6 +16,7 @@
|
||||
|
||||
#include "support/os.h"
|
||||
|
||||
#include "support/FileName.h"
|
||||
#include "support/lstrings.h"
|
||||
#include "support/debug.h"
|
||||
|
||||
|
@ -14,6 +14,7 @@
|
||||
|
||||
#include "support/os.h"
|
||||
#include "support/docstring.h"
|
||||
#include "support/FileName.h"
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <Carbon/Carbon.h>
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
||||
|
@ -21,9 +21,10 @@
|
||||
#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()),
|
||||
|
Loading…
Reference in New Issue
Block a user