using lyx::pos_type;
-using lyx::support::AddPath;
+using lyx::support::addPath;
using lyx::support::bformat;
using lyx::support::FileFilterList;
-using lyx::support::FileSearch;
+using lyx::support::fileSearch;
using lyx::support::ForkedcallsController;
using lyx::support::isDirWriteable;
-using lyx::support::MakeDisplayPath;
-using lyx::support::MakeAbsPath;
+using lyx::support::makeDisplayPath;
+using lyx::support::makeAbsPath;
using lyx::support::package;
using std::endl;
{
// Get absolute path of file and add ".lyx"
// to the filename if necessary
- string s = FileSearch(string(), filename, "lyx");
+ string s = fileSearch(string(), filename, "lyx");
bool const found = !s.empty();
// File already open?
if (bufferlist.exists(s)) {
- string const file = MakeDisplayPath(s, 20);
+ string const file = makeDisplayPath(s, 20);
string text = bformat(_("The document %1$s is already "
"loaded.\n\nDo you want to revert "
"to the saved version?"), file);
make_pair(string(_("Documents|#o#O")),
string(lyxrc.document_path)),
make_pair(string(_("Examples|#E#e")),
- string(AddPath(package().system_support(), "examples"))));
+ string(addPath(package().system_support(), "examples"))));
FileDialog::Result result =
fileDlg.open(initpath,
// Get absolute path of file and add ".lyx"
// to the filename if necessary
- filename = FileSearch(string(), filename, "lyx");
+ filename = fileSearch(string(), filename, "lyx");
- string const disp_fn = MakeDisplayPath(filename);
+ string const disp_fn = makeDisplayPath(filename);
owner_->message(bformat(_("Inserting document %1$s..."), disp_fn));
string res;
Buffer buf("", false);
buf.error.connect(boost::bind(&BufferView::Pimpl::addError, this, _1));
- if (::loadLyXFile(&buf, MakeAbsPath(filename))) {
+ if (::loadLyXFile(&buf, makeAbsPath(filename))) {
lyx::cap::pasteParagraphList(cursor_, buf.paragraphs(),
buf.params().textclass);
res = _("Document %1$s inserted.");
#include <fstream>
-using lyx::support::ChangeExtension;
-using lyx::support::OnlyFilename;
+using lyx::support::changeExtension;
+using lyx::support::onlyFilename;
using lyx::support::split;
using lyx::support::Systemcall;
int Chktex::run(TeXErrors &terr)
{
// run bibtex
- string log = OnlyFilename(ChangeExtension(file, ".log"));
+ string log = onlyFilename(changeExtension(file, ".log"));
string tmp = cmd + " -q -v0 -b0 -x " + file + " -o " + log;
Systemcall one;
int result = one.startscript(Systemcall::Wait, tmp);
string token;
int retval = 0;
- string const tmp = OnlyFilename(ChangeExtension(file, ".log"));
+ string const tmp = onlyFilename(changeExtension(file, ".log"));
#if USE_BOOST_FORMAT
boost::format msg(_("ChkTeX warning id # %1$d"));
#endif
using lyx::support::ltrim;
-using lyx::support::MakeAbsPath;
-using lyx::support::OnlyFilename;
+using lyx::support::makeAbsPath;
+using lyx::support::onlyFilename;
using lyx::support::suffixIs;
using lyx::support::sum;
void DepTable::insert(string const & fi, bool upd)
{
// not quite sure if this is the correct place for MakeAbsPath
- string const f = MakeAbsPath(fi);
+ string const f = makeAbsPath(fi);
if (deplist.find(f) == deplist.end()) {
dep_info di;
di.crc_prev = 0;
bool DepTable::haschanged(string const & f) const
{
// not quite sure if this is the correct place for MakeAbsPath
- string const fil = MakeAbsPath(f);
+ string const fil = makeAbsPath(f);
DepList::const_iterator cit = deplist.find(fil);
if (cit != deplist.end()) {
if (cit->second.changed())
DepList::iterator cit = deplist.begin();
DepList::iterator end = deplist.end();
while (cit != end) {
- if (OnlyFilename(cit->first) == filename) {
+ if (onlyFilename(cit->first) == filename) {
// Can't erase the current iterator, but we
// can increment and then erase.
// deplist is a map so only the erased
#include <fstream>
-using lyx::support::AbsolutePath;
+using lyx::support::absolutePath;
using lyx::support::bformat;
-using lyx::support::ChangeExtension;
+using lyx::support::changeExtension;
using lyx::support::contains;
using lyx::support::findtexfile;
using lyx::support::getcwd;
-using lyx::support::OnlyFilename;
+using lyx::support::onlyFilename;
using lyx::support::prefixIs;
-using lyx::support::QuoteName;
+using lyx::support::quoteName;
using lyx::support::rtrim;
using lyx::support::split;
using lyx::support::subst;
depfile = file + ".dep";
if (prefixIs(cmd, "pdf")) { // Do we use pdflatex ?
depfile += "-pdf";
- output_file = ChangeExtension(file,".pdf");
+ output_file = changeExtension(file,".pdf");
} else {
- output_file = ChangeExtension(file,".dvi");
+ output_file = changeExtension(file,".dvi");
}
}
// but the reason for the error might be in a generated file...
- string const ofname = OnlyFilename(file);
+ string const ofname = onlyFilename(file);
// bibtex file
- string const bbl = ChangeExtension(ofname, ".bbl");
+ string const bbl = changeExtension(ofname, ".bbl");
unlink(bbl);
// makeindex file
- string const ind = ChangeExtension(ofname, ".ind");
+ string const ind = changeExtension(ofname, ".ind");
unlink(ind);
// Also remove the aux file
- string const aux = ChangeExtension(ofname, ".aux");
+ string const aux = changeExtension(ofname, ".aux");
unlink(aux);
}
bool had_depfile = fs::exists(depfile);
bool run_bibtex = false;
- string aux_file = OnlyFilename(ChangeExtension(file, "aux"));
+ string aux_file = onlyFilename(changeExtension(file, "aux"));
if (had_depfile) {
lyxerr[Debug::DEPEND] << "Dependency file exists" << endl;
// if needed.
// run makeindex
- if (head.haschanged(OnlyFilename(ChangeExtension(file, ".idx")))) {
+ if (head.haschanged(onlyFilename(changeExtension(file, ".idx")))) {
// no checks for now
lyxerr[Debug::LATEX] << "Running MakeIndex." << endl;
message(_("Running MakeIndex."));
- rerun = runMakeIndex(OnlyFilename(ChangeExtension(file, ".idx")), runparams);
+ rerun = runMakeIndex(onlyFilename(changeExtension(file, ".idx")), runparams);
}
// run bibtex
// more after this.
// run makeindex if the <file>.idx has changed or was generated.
- if (head.haschanged(OnlyFilename(ChangeExtension(file, ".idx")))) {
+ if (head.haschanged(onlyFilename(changeExtension(file, ".idx")))) {
// no checks for now
lyxerr[Debug::LATEX] << "Running MakeIndex." << endl;
message(_("Running MakeIndex."));
- rerun = runMakeIndex(OnlyFilename(ChangeExtension(file, ".idx")), runparams);
+ rerun = runMakeIndex(onlyFilename(changeExtension(file, ".idx")), runparams);
}
// 2
int LaTeX::startscript()
{
- string tmp = cmd + ' ' + QuoteName(file) + " > " + os::nulldev();
+ string tmp = cmd + ' ' + quoteName(file) + " > " + os::nulldev();
Systemcall one;
return one.startscript(Systemcall::Wait, tmp);
}
<< f << endl;
string tmp = lyxrc.index_command + " ";
tmp = subst(tmp, "$$lang", runparams.document_language);
- tmp += QuoteName(f);
+ tmp += quoteName(f);
Systemcall one;
one.startscript(Systemcall::Wait, tmp);
return true;
result.push_back(scanAuxFile(file));
for (int i = 1; i < 1000; ++i) {
- string const file2 = ChangeExtension(file, "")
+ string const file2 = changeExtension(file, "")
+ '.' + convert<string>(i)
+ ".aux";
if (!fs::exists(file2))
while (!data.empty()) {
string database;
data = split(data, database, ',');
- database = ChangeExtension(database, "bib");
+ database = changeExtension(database, "bib");
lyxerr[Debug::LATEX] << "BibTeX database: `"
<< database << '\'' << endl;
aux_info.databases.insert(database);
string style = sub.str(1);
// token is now the style file
// pass it to the helper
- style = ChangeExtension(style, "bst");
+ style = changeExtension(style, "bst");
lyxerr[Debug::LATEX] << "BibTeX style: `"
<< style << '\'' << endl;
aux_info.styles.insert(style);
result = true;
string tmp = lyxrc.bibtex_command + " ";
- tmp += QuoteName(OnlyFilename(ChangeExtension(it->aux_file, string())));
+ tmp += quoteName(onlyFilename(changeExtension(it->aux_file, string())));
Systemcall one;
one.startscript(Systemcall::Wait, tmp);
}
int last_line = -1;
int line_count = 1;
int retval = NO_ERRORS;
- string tmp = OnlyFilename(ChangeExtension(file, ".log"));
+ string tmp = onlyFilename(changeExtension(file, ".log"));
lyxerr[Debug::LATEX] << "Log file: " << tmp << endl;
ifstream ifs(tmp.c_str());
// (1) foundfile is an
// absolute path and should
// be inserted.
- if (AbsolutePath(foundfile)) {
+ if (absolutePath(foundfile)) {
lyxerr[Debug::DEPEND] << "AbsolutePath file: "
<< foundfile << endl;
// On initial insert we want to do the update at once
return;
}
- string const onlyfile = OnlyFilename(foundfile);
+ string const onlyfile = onlyFilename(foundfile);
// (2) foundfile is in the tmpdir
// insert it into head
// files used by the LaTeX run. The files are then entered into the
// dependency file.
- string const logfile = OnlyFilename(ChangeExtension(file, ".log"));
+ string const logfile = onlyFilename(changeExtension(file, ".log"));
static regex reg1(".*\\([^)]+.*");
static regex reg2("File: ([^ ]+).*");
}
// Make sure that the main .tex file is in the dependancy file.
- head.insert(OnlyFilename(file), true);
+ head.insert(onlyFilename(file), true);
}
#include <sstream>
using lyx::support::isSGMLFilename;
-using lyx::support::LibFileSearch;
-using lyx::support::MakeRelPath;
-using lyx::support::OnlyPath;
+using lyx::support::libFileSearch;
+using lyx::support::makeRelPath;
+using lyx::support::onlyPath;
using std::endl;
using std::find;
void LaTeXFeatures::getAvailable()
{
LyXLex lex(0, 0);
- string real_file = LibFileSearch("", "packages.lst");
+ string real_file = libFileSearch("", "packages.lst");
if (real_file.empty())
return;
string const LaTeXFeatures::getIncludedFiles(string const & fname) const
{
ostringstream sgmlpreamble;
- string const basename = OnlyPath(fname);
+ string const basename = onlyPath(fname);
FileMap::const_iterator end = IncludedFiles_.end();
for (FileMap::const_iterator fi = IncludedFiles_.begin();
fi != end; ++fi)
sgmlpreamble << "\n<!ENTITY " << fi->first
<< (isSGMLFilename(fi->second) ? " SYSTEM \"" : " \"")
- << MakeRelPath(fi->second, basename) << "\">";
+ << makeRelPath(fi->second, basename) << "\">";
return sgmlpreamble.str();
}
using lyx::support::compare_ascii_no_case;
using lyx::support::contains;
-using lyx::support::MakeDisplayPath;
+using lyx::support::makeDisplayPath;
using lyx::support::token;
using boost::bind;
for (; lfit != lf.end() && ii < 10; ++lfit, ++ii) {
string const label = convert<string>(ii) + ". "
- + MakeDisplayPath((*lfit), 30)
+ + makeDisplayPath((*lfit), 30)
+ '|' + convert<string>(ii);
tomenu.add(MenuItem(MenuItem::Command, label, FuncRequest(LFUN_FILE_OPEN, (*lfit))), view);
}
Strings::const_iterator docit = names.begin();
Strings::const_iterator end = names.end();
for (; docit != end; ++docit, ++ii) {
- string label = MakeDisplayPath(*docit, 20);
+ string label = makeDisplayPath(*docit, 20);
if (ii < 10)
label = convert<string>(ii) + ". " + label + '|' + convert<string>(ii);
tomenu.add(MenuItem(MenuItem::Command, label, FuncRequest(LFUN_SWITCHBUFFER, *docit)), view);
using lyx::support::compare_ascii_no_case;
using lyx::support::getVectorFromString;
-using lyx::support::LibFileSearch;
+using lyx::support::libFileSearch;
using lyx::support::subst;
using std::endl;
if (!f.argument.empty())
xpm_name = subst(name + ' ' + f.argument, ' ', '_');
- fullname = LibFileSearch("images", xpm_name, "xpm");
+ fullname = libFileSearch("images", xpm_name, "xpm");
if (fullname.empty()) {
// try without the argument
- fullname = LibFileSearch("images", name, "xpm");
+ fullname = libFileSearch("images", name, "xpm");
}
}
lyxerr[Debug::GUI] << "Cannot find icon for command \""
<< lyxaction.getActionName(f.action)
<< '(' << f.argument << ")\"" << endl;
- return LibFileSearch("images", "unknown", "xpm");
+ return libFileSearch("images", "unknown", "xpm");
}
using lyx::pos_type;
using lyx::pit_type;
-using lyx::support::AddName;
+using lyx::support::addName;
using lyx::support::bformat;
-using lyx::support::ChangeExtension;
+using lyx::support::changeExtension;
using lyx::support::cmd_ret;
using lyx::support::createBufferTmpDir;
using lyx::support::destroyDir;
using lyx::support::getFormatFromContents;
using lyx::support::isDirWriteable;
-using lyx::support::LibFileSearch;
+using lyx::support::libFileSearch;
using lyx::support::latex_path;
using lyx::support::ltrim;
-using lyx::support::MakeAbsPath;
-using lyx::support::MakeDisplayPath;
-using lyx::support::MakeLatexName;
-using lyx::support::OnlyFilename;
-using lyx::support::OnlyPath;
+using lyx::support::makeAbsPath;
+using lyx::support::makeDisplayPath;
+using lyx::support::makeLatexName;
+using lyx::support::onlyFilename;
+using lyx::support::onlyPath;
using lyx::support::Path;
-using lyx::support::QuoteName;
+using lyx::support::quoteName;
using lyx::support::removeAutosaveFile;
using lyx::support::rename;
-using lyx::support::RunCommand;
+using lyx::support::runCommand;
using lyx::support::split;
using lyx::support::subst;
using lyx::support::tempName;
Buffer::Impl::Impl(Buffer & parent, string const & file, bool readonly_)
: lyx_clean(true), bak_clean(true), unnamed(false), read_only(readonly_),
- filename(file), filepath(OnlyPath(file)), file_fully_loaded(false),
+ filename(file), filepath(onlyPath(file)), file_fully_loaded(false),
inset(params)
{
inset.setAutoBreakRows(true);
string const Buffer::getLatexName(bool const no_path) const
{
- string const name = ChangeExtension(MakeLatexName(fileName()), ".tex");
- return no_path ? OnlyFilename(name) : name;
+ string const name = changeExtension(makeLatexName(fileName()), ".tex");
+ return no_path ? onlyFilename(name) : name;
}
string const path = temppath();
- string const fname = AddName(path,
- OnlyFilename(ChangeExtension(filename,
+ string const fname = addName(path,
+ onlyFilename(changeExtension(filename,
".log")));
string const bname =
- AddName(path, OnlyFilename(
- ChangeExtension(filename,
+ addName(path, onlyFilename(
+ changeExtension(filename,
formats.extension("literate") + ".out")));
// If no Latex log or Build log is newer, show Build log
void Buffer::setFileName(string const & newfile)
{
- pimpl_->filename = MakeAbsPath(newfile);
- pimpl_->filepath = OnlyPath(pimpl_->filename);
+ pimpl_->filename = makeAbsPath(newfile);
+ pimpl_->filepath = onlyPath(pimpl_->filename);
setReadonly(fs::is_readonly(pimpl_->filename));
updateTitles();
}
filename));
return false;
}
- string const lyx2lyx = LibFileSearch("lyx2lyx", "lyx2lyx");
+ string const lyx2lyx = libFileSearch("lyx2lyx", "lyx2lyx");
if (lyx2lyx.empty()) {
Alert::error(_("Conversion script not found"),
bformat(_("%1$s is from an earlier"
return false;
}
ostringstream command;
- command << "python " << QuoteName(lyx2lyx)
+ command << "python " << quoteName(lyx2lyx)
<< " -t " << convert<string>(LYX_FORMAT)
- << " -o " << QuoteName(tmpfile) << ' '
- << QuoteName(filename);
+ << " -o " << quoteName(tmpfile) << ' '
+ << quoteName(filename);
string const command_str = command.str();
lyxerr[Debug::INFO] << "Running '"
<< command_str << '\''
<< endl;
- cmd_ret const ret = RunCommand(command_str);
+ cmd_ret const ret = runCommand(command_str);
if (ret.first != 0) {
Alert::error(_("Conversion script failed"),
bformat(_("%1$s is from an earlier version"
if (lyxrc.make_backup) {
s = fileName() + '~';
if (!lyxrc.backupdir_path.empty())
- s = AddName(lyxrc.backupdir_path,
+ s = addName(lyxrc.backupdir_path,
subst(os::internal_path(s),'/','!'));
// It might very well be that this variant is just
ofs << tclass.class_header();
string preamble = params().preamble;
- string const name = runparams.nice ? ChangeExtension(pimpl_->filename, ".sgml")
+ string const name = runparams.nice ? changeExtension(pimpl_->filename, ".sgml")
: fname;
preamble += features.getIncludedFiles(name);
preamble += features.getLyXSGMLEntities();
preamble += "<!ENTITY % output.print.bmp \"IGNORE\">\n";
}
- string const name = runparams.nice ? ChangeExtension(pimpl_->filename, ".sgml")
+ string const name = runparams.nice ? changeExtension(pimpl_->filename, ".sgml")
: fname;
preamble += features.getIncludedFiles(name);
preamble += features.getLyXSGMLEntities();
using lyx::pit_type;
using lyx::support::bformat;
-using lyx::support::LibFileSearch;
-using lyx::support::MakeDisplayPath;
-using lyx::support::OnlyFilename;
-using lyx::support::OnlyPath;
+using lyx::support::libFileSearch;
+using lyx::support::makeDisplayPath;
+using lyx::support::onlyFilename;
+using lyx::support::onlyPath;
using lyx::support::unlink;
using std::min;
// File information about normal file
if (!fs::exists(s)) {
- string const file = MakeDisplayPath(s, 50);
+ string const file = makeDisplayPath(s, 50);
string text = bformat(_("The specified document\n%1$s"
"\ncould not be read."), file);
Alert::error(_("Could not read document"), text);
}
// Check if emergency save file exists and is newer.
- string const e = OnlyPath(s) + OnlyFilename(s) + ".emergency";
+ string const e = onlyPath(s) + onlyFilename(s) + ".emergency";
if (fs::exists(e) && fs::exists(s)
&& fs::last_write_time(e) > fs::last_write_time(s))
{
- string const file = MakeDisplayPath(s, 20);
+ string const file = makeDisplayPath(s, 20);
string const text =
bformat(_("An emergency save of the document "
"%1$s exists.\n\n"
}
// Now check if autosave file is newer.
- string const a = OnlyPath(s) + '#' + OnlyFilename(s) + '#';
+ string const a = onlyPath(s) + '#' + onlyFilename(s) + '#';
if (fs::exists(a) && fs::exists(s)
&& fs::last_write_time(a) > fs::last_write_time(s))
{
- string const file = MakeDisplayPath(s, 20);
+ string const file = makeDisplayPath(s, 20);
string const text =
bformat(_("The backup of the document "
"%1$s is newer.\n\nLoad the "
return true;
}
} else {
- string const file = MakeDisplayPath(s, 20);
+ string const file = makeDisplayPath(s, 20);
// Here we probably should run
if (LyXVC::file_not_found_hook(s)) {
string const text =
string tname;
// use defaults.lyx as a default template if it exists.
if (templatename.empty())
- tname = LibFileSearch("templates", "defaults.lyx");
+ tname = libFileSearch("templates", "defaults.lyx");
else
tname = templatename;
if (!tname.empty()) {
if (!b->readFile(tname)) {
- string const file = MakeDisplayPath(tname, 50);
+ string const file = makeDisplayPath(tname, 50);
string const text = bformat(_("The specified document template\n%1$s\ncould not be read."), file);
Alert::error(_("Could not read template"), text);
// no template, start with empty buffer
#include <algorithm>
#include <functional>
-using lyx::support::AddName;
+using lyx::support::addName;
using lyx::support::bformat;
-using lyx::support::MakeAbsPath;
-using lyx::support::MakeDisplayPath;
-using lyx::support::OnlyFilename;
+using lyx::support::makeAbsPath;
+using lyx::support::makeDisplayPath;
+using lyx::support::onlyFilename;
using lyx::support::removeAutosaveFile;
using lyx::support::package;
using lyx::support::prefixIs;
string file;
if (buf->isUnnamed())
- file = OnlyFilename(buf->fileName());
+ file = onlyFilename(buf->fileName());
else
- file = MakeDisplayPath(buf->fileName(), 30);
+ file = makeDisplayPath(buf->fileName(), 30);
string const text =
bformat(_("The document %1$s has unsaved changes.\n\n"
string fname;
if (buf->isUnnamed())
- fname = OnlyFilename(buf->fileName());
+ fname = onlyFilename(buf->fileName());
else
- fname = MakeDisplayPath(buf->fileName(), 30);
+ fname = makeDisplayPath(buf->fileName(), 30);
string const text =
bformat(_("The document %1$s has unsaved changes.\n\n"
return;
string const doc = buf->isUnnamed()
- ? OnlyFilename(buf->fileName()) : buf->fileName();
+ ? onlyFilename(buf->fileName()) : buf->fileName();
lyxerr << bformat(_("LyX: Attempting to save document %1$s"), doc) << endl;
}
// 2) In HOME directory.
- string s = AddName(package().home_dir(), buf->fileName());
+ string s = addName(package().home_dir(), buf->fileName());
s += ".emergency";
lyxerr << ' ' << s << endl;
if (buf->writeFile(s)) {
// 3) In "/tmp" directory.
// MakeAbsPath to prepend the current
// drive letter on OS/2
- s = AddName(package().temp_dir(), buf->fileName());
+ s = addName(package().temp_dir(), buf->fileName());
s += ".emergency";
lyxerr << ' ' << s << endl;
if (buf->writeFile(s)) {
#include <fstream>
-using lyx::support::LibFileSearch;
+using lyx::support::libFileSearch;
using boost::regex;
using boost::smatch;
// open definition file
lyxerr[Debug::KBMAP]
<< "Reading character set file " << fname << ".cdef" << endl;
- string const filename = LibFileSearch("kbd", fname, "cdef");
+ string const filename = libFileSearch("kbd", fname, "cdef");
ifstream ifs(filename.c_str());
if (!ifs) {
lyxerr << "Unable to open character set file" << endl;
#include "support/path.h"
#include "support/systemcall.h"
-using lyx::support::AddName;
+using lyx::support::addName;
using lyx::support::bformat;
-using lyx::support::ChangeExtension;
+using lyx::support::changeExtension;
using lyx::support::compare_ascii_no_case;
using lyx::support::contains;
-using lyx::support::DirList;
-using lyx::support::GetExtension;
+using lyx::support::dirList;
+using lyx::support::getExtension;
using lyx::support::isFileReadable;
-using lyx::support::LibFileSearch;
-using lyx::support::LibScriptSearch;
-using lyx::support::MakeRelPath;
-using lyx::support::OnlyFilename;
-using lyx::support::OnlyPath;
+using lyx::support::libFileSearch;
+using lyx::support::libScriptSearch;
+using lyx::support::makeRelPath;
+using lyx::support::onlyFilename;
+using lyx::support::onlyPath;
using lyx::support::Path;
using lyx::support::prefixIs;
-using lyx::support::QuoteName;
+using lyx::support::quoteName;
using lyx::support::split;
using lyx::support::subst;
using lyx::support::Systemcall;
string & to_file, bool try_default)
{
string const to_ext = formats.extension(to_format);
- to_file = ChangeExtension(to_file_base, to_ext);
+ to_file = changeExtension(to_file_base, to_ext);
if (from_format == to_format)
return move(from_format, from_file, to_file, false);
// if no special converter defined, then we take the
// default one from ImageMagic.
string const from_ext = from_format.empty() ?
- GetExtension(from_file) :
+ getExtension(from_file) :
formats.extension(from_format);
string const command =
"sh " +
- QuoteName(LibFileSearch("scripts", "convertDefault.sh")) +
+ quoteName(libFileSearch("scripts", "convertDefault.sh")) +
' ' +
- QuoteName(from_ext + ':' + from_file) +
+ quoteName(from_ext + ':' + from_file) +
' ' +
- QuoteName(to_ext + ':' + to_file);
+ quoteName(to_ext + ':' + to_file);
lyxerr[Debug::FILES]
<< "No converter defined! "
"I use convertDefault.sh:\n\t"
}
OutputParams runparams;
runparams.flavor = getFlavor(edgepath);
- string path = OnlyPath(from_file);
+ string path = onlyPath(from_file);
Path p(path);
bool run_latex = false;
- string from_base = ChangeExtension(from_file, "");
- string to_base = ChangeExtension(to_file, "");
+ string from_base = changeExtension(from_file, "");
+ string to_base = changeExtension(to_file, "");
string infile;
string outfile = from_file;
for (Graph::EdgePath::const_iterator cit = edgepath.begin();
<< conv.from << " to " << conv.to << endl;
infile = outfile;
outfile = conv.result_dir.empty()
- ? ChangeExtension(from_file, conv.To->extension())
- : AddName(subst(conv.result_dir,
+ ? changeExtension(from_file, conv.To->extension())
+ : addName(subst(conv.result_dir,
token_base, from_base),
subst(conv.result_file,
- token_base, OnlyFilename(from_base)));
+ token_base, onlyFilename(from_base)));
// if input and output files are equal, we use a
// temporary file as intermediary (JMarc)
string real_outfile;
if (outfile == infile) {
real_outfile = infile;
- outfile = AddName(buffer->temppath(), "tmpfile.out");
+ outfile = addName(buffer->temppath(), "tmpfile.out");
}
if (conv.latex) {
}
string const infile2 = (conv.original_dir)
- ? infile : MakeRelPath(infile, path);
+ ? infile : makeRelPath(infile, path);
string const outfile2 = (conv.original_dir)
- ? outfile : MakeRelPath(outfile, path);
+ ? outfile : makeRelPath(outfile, path);
string command = conv.command;
- command = subst(command, token_from, QuoteName(infile2));
- command = subst(command, token_base, QuoteName(from_base));
- command = subst(command, token_to, QuoteName(outfile2));
- command = LibScriptSearch(command);
+ command = subst(command, token_from, quoteName(infile2));
+ command = subst(command, token_base, quoteName(from_base));
+ command = subst(command, token_to, quoteName(outfile2));
+ command = libScriptSearch(command);
if (!conv.parselog.empty())
- command += " 2> " + QuoteName(infile2 + ".out");
+ command += " 2> " + quoteName(infile2 + ".out");
if (conv.from == "dvi" && conv.to == "ps")
command = add_options(command,
if (!conv.parselog.empty()) {
string const logfile = infile2 + ".log";
- string const script = LibScriptSearch(conv.parselog);
+ string const script = libScriptSearch(conv.parselog);
string const command2 = script +
- " < " + QuoteName(infile2 + ".out") +
- " > " + QuoteName(logfile);
+ " < " + quoteName(infile2 + ".out") +
+ " > " + quoteName(logfile);
one.startscript(Systemcall::Wait, command2);
if (!scanLog(*buffer, command, logfile))
return false;
return true;
if (!conv.result_dir.empty()) {
- to_file = AddName(subst(conv.result_dir, token_base, to_base),
+ to_file = addName(subst(conv.result_dir, token_base, to_base),
subst(conv.result_file,
- token_base, OnlyFilename(to_base)));
+ token_base, onlyFilename(to_base)));
if (from_base != to_base) {
string const from = subst(conv.result_dir,
token_base, from_base);
return true;
bool no_errors = true;
- string const path = OnlyPath(from);
- string const base = OnlyFilename(ChangeExtension(from, ""));
- string const to_base = ChangeExtension(to, "");
- string const to_extension = GetExtension(to);
+ string const path = onlyPath(from);
+ string const base = onlyFilename(changeExtension(from, ""));
+ string const to_base = changeExtension(to, "");
+ string const to_extension = getExtension(to);
- vector<string> files = DirList(OnlyPath(from), GetExtension(from));
+ vector<string> files = dirList(onlyPath(from), getExtension(from));
for (vector<string>::const_iterator it = files.begin();
it != files.end(); ++it)
if (prefixIs(*it, base)) {
string const from2 = path + *it;
string to2 = to_base + it->substr(base.length());
- to2 = ChangeExtension(to2, to_extension);
+ to2 = changeExtension(to2, to_extension);
lyxerr[Debug::FILES] << "moving " << from2
<< " to " << to2 << endl;
#include <boost/filesystem/operations.hpp>
-using lyx::support::AddName;
+using lyx::support::addName;
using lyx::support::bformat;
-using lyx::support::ChangeExtension;
+using lyx::support::changeExtension;
using lyx::support::contains;
-using lyx::support::MakeAbsPath;
-using lyx::support::MakeDisplayPath;
-using lyx::support::OnlyFilename;
-using lyx::support::OnlyPath;
+using lyx::support::makeAbsPath;
+using lyx::support::makeDisplayPath;
+using lyx::support::onlyFilename;
+using lyx::support::onlyPath;
using lyx::support::package;
using lyx::support::prefixIs;
if (fs::exists(filename)) {
string text = bformat(_("The file %1$s already exists.\n\n"
"Do you want to over-write that file?"),
- MakeDisplayPath(filename));
+ makeDisplayPath(filename));
return Alert::prompt(_("Over-write file?"),
text, 0, 2,
_("&Over-write"), _("Over-write &all"),
// overwrite themselves. This check could be changed to
// boost::filesystem::equivalent(sourceFile, destFile) if export to
// other directories than the document directory is desired.
- if (!prefixIs(OnlyPath(sourceFile), package().temp_dir()))
+ if (!prefixIs(onlyPath(sourceFile), package().temp_dir()))
return ret;
if (!force) {
if (!mover.copy(sourceFile, destFile, latexFile))
Alert::error(_("Couldn't copy file"),
bformat(_("Copying %1$s to %2$s failed."),
- MakeDisplayPath(sourceFile),
- MakeDisplayPath(destFile)));
+ makeDisplayPath(sourceFile),
+ makeDisplayPath(destFile)));
return ret;
}
}
string filename = buffer->getLatexName(false);
- filename = AddName(buffer->temppath(), filename);
- filename = ChangeExtension(filename,
+ filename = addName(buffer->temppath(), filename);
+ filename = changeExtension(filename,
formats.extension(backend_format));
// Ascii backend
if (!put_in_tempdir) {
string const tmp_result_file = result_file;
- result_file = ChangeExtension(buffer->fileName(),
+ result_file = changeExtension(buffer->fileName(),
formats.extension(format));
// We need to copy referenced files (e. g. included graphics
// if format == "dvi") to the result dir.
vector<ExportedFile> const files =
runparams.exportdata->externalFiles(format);
- string const dest = OnlyPath(result_file);
+ string const dest = onlyPath(result_file);
CopyStatus status = SUCCESS;
for (vector<ExportedFile>::const_iterator it = files.begin();
it != files.end() && status != CANCEL; ++it) {
string const fmt =
formats.getFormatFromFile(it->sourceName);
status = copyFile(fmt, it->sourceName,
- MakeAbsPath(it->exportName, dest),
+ makeAbsPath(it->exportName, dest),
it->exportName, status == FORCE);
}
if (status == CANCEL) {
buffer->message(bformat(_("Document exported as %1$s "
"to file `%2$s'"),
formats.prettyName(format),
- MakeDisplayPath(result_file)));
+ makeDisplayPath(result_file)));
} else {
// This must be a dummy converter like fax (bug 1888)
buffer->message(bformat(_("Document exported as %1$s"),
string const & sourceName,
string const & exportName)
{
- BOOST_ASSERT(lyx::support::AbsolutePath(sourceName));
+ BOOST_ASSERT(lyx::support::absolutePath(sourceName));
// Make sure that we have every file only once, otherwise copyFile()
// would ask several times if it should overwrite a file.
void ExportData::addExternalFile(string const & format,
string const & sourceName)
{
- addExternalFile(format, sourceName, OnlyFilename(sourceName));
+ addExternalFile(format, sourceName, onlyFilename(sourceName));
}
using lyx::support::bformat;
using lyx::support::compare_ascii_no_case;
using lyx::support::contains;
-using lyx::support::LibScriptSearch;
-using lyx::support::MakeDisplayPath;
-using lyx::support::OnlyFilename;
-using lyx::support::OnlyPath;
+using lyx::support::libScriptSearch;
+using lyx::support::makeDisplayPath;
+using lyx::support::onlyFilename;
+using lyx::support::onlyPath;
using lyx::support::Path;
-using lyx::support::QuoteName;
+using lyx::support::quoteName;
using lyx::support::subst;
using lyx::support::Systemcall;
return format;
// try to find a format from the file extension.
- string const ext(lyx::support::GetExtension(filename));
+ string const ext(lyx::support::getExtension(filename));
if (!ext.empty()) {
// this is ambigous if two formats have the same extension,
// but better than nothing
return false;
}
- string command = LibScriptSearch(format->viewer());
+ string command = libScriptSearch(format->viewer());
if (format_name == "dvi" &&
!lyxrc.view_dvi_paper_option.empty()) {
command += ' ' + token_from;
command = subst(command, token_from,
- QuoteName(OnlyFilename(filename)));
- command = subst(command, token_path, QuoteName(OnlyPath(filename)));
- command = subst(command, token_socket, QuoteName(lyxsocket->address()));
+ quoteName(onlyFilename(filename)));
+ command = subst(command, token_path, quoteName(onlyPath(filename)));
+ command = subst(command, token_socket, quoteName(lyxsocket->address()));
lyxerr[Debug::FILES] << "Executing command: " << command << std::endl;
buffer.message(_("Executing command: ") + command);
- Path p(OnlyPath(filename));
+ Path p(onlyPath(filename));
Systemcall one;
int const res = one.startscript(Systemcall::DontWait, command);
if (res) {
Alert::error(_("Cannot view file"),
bformat(_("An error occurred whilst running %1$s"),
- MakeDisplayPath(command, 50)));
+ makeDisplayPath(command, 50)));
return false;
}
return true;
command += ' ' + token_from;
command = subst(command, token_from,
- QuoteName(OnlyFilename(filename)));
- command = subst(command, token_path, QuoteName(OnlyPath(filename)));
- command = subst(command, token_socket, QuoteName(lyxsocket->address()));
+ quoteName(onlyFilename(filename)));
+ command = subst(command, token_path, quoteName(onlyPath(filename)));
+ command = subst(command, token_socket, quoteName(lyxsocket->address()));
lyxerr[Debug::FILES] << "Executing command: " << command << std::endl;
buffer.message(_("Executing command: ") + command);
- Path p(OnlyPath(filename));
+ Path p(onlyPath(filename));
Systemcall one;
int const res = one.startscript(Systemcall::DontWait, command);
if (res) {
Alert::error(_("Cannot edit file"),
bformat(_("An error occurred whilst running %1$s"),
- MakeDisplayPath(command, 50)));
+ makeDisplayPath(command, 50)));
return false;
}
return true;
# include <unistd.h>
#endif
-using lyx::support::MakeDisplayPath;
-using lyx::support::OnlyFilename;
+using lyx::support::makeDisplayPath;
+using lyx::support::onlyFilename;
using std::endl;
using std::string;
if (view()->available()) {
string const cur_title = buffer()->fileName();
if (!cur_title.empty()) {
- maximize_title += ": " + MakeDisplayPath(cur_title, 30);
- minimize_title = OnlyFilename(cur_title);
+ maximize_title += ": " + makeDisplayPath(cur_title, 30);
+ minimize_title = onlyFilename(cur_title);
if (!buffer()->isClean()) {
maximize_title += _(" (changed)");
minimize_title += '*';
namespace lyx {
-using support::FileSearch;
-using support::MakeDisplayPath;
+using support::fileSearch;
+using support::makeDisplayPath;
using support::package;
namespace frontend {
void ControlAboutlyx::getCredits(ostream & ss) const
{
- string const name = FileSearch(package().system_support(), "CREDITS");
+ string const name = fileSearch(package().system_support(), "CREDITS");
bool found(!name.empty());
<< lyx_release_date
<< "\n"
<< _("Library directory: ")
- << MakeDisplayPath(package().system_support())
+ << makeDisplayPath(package().system_support())
<< "\n"
<< _("User directory: ")
- << MakeDisplayPath(package().user_support());
+ << makeDisplayPath(package().user_support());
return ss.str();
}
using support::contains;
using support::FileFilterList;
-using support::OnlyFilename;
+using support::onlyFilename;
using support::prefixIs;
using support::split;
vector<string>::iterator it = data.begin();
vector<string>::iterator end = data.end();
for (; it != end; ++it) {
- *it = OnlyFilename(*it);
+ *it = onlyFilename(*it);
}
// sort on filename only (no path)
std::sort(data.begin(), data.end());
vector<string>::iterator it = data.begin();
vector<string>::iterator end = data.end();
for (; it != end; ++it) {
- *it = OnlyFilename(*it);
+ *it = onlyFilename(*it);
}
// sort on filename only (no path)
std::sort(data.begin(), data.end());
namespace lyx {
using support::FileFilterList;
-using support::MakeAbsPath;
+using support::makeAbsPath;
using support::readBB_from_PSFile;
namespace frontend {
string const ControlExternal::readBB(string const & file)
{
string const abs_file =
- MakeAbsPath(file, kernel().bufferFilepath());
+ makeAbsPath(file, kernel().bufferFilepath());
// try to get it from the file, if possible. Zipped files are
// unzipped in the readBB_from_PSFile-Function
namespace lyx {
-using support::AddName;
+using support::addName;
using support::FileFilterList;
using support::isFileReadable;
-using support::MakeAbsPath;
+using support::makeAbsPath;
using support::package;
using support::readBB_from_PSFile;
string const title = _("Select graphics file");
// Does user clipart directory exist?
- string clipdir = AddName (package().user_support(), "clipart");
+ string clipdir = addName(package().user_support(), "clipart");
if (!(fs::exists(clipdir) && fs::is_directory(clipdir)))
// No - bail out to system clipart directory
- clipdir = AddName (package().system_support(), "clipart");
+ clipdir = addName(package().system_support(), "clipart");
pair<string, string> dir1(_("Clipart|#C#c"), clipdir);
pair<string, string> dir2(_("Documents|#o#O"), string(lyxrc.document_path));
// Show the file browser dialog
string const ControlGraphics::readBB(string const & file)
{
string const abs_file =
- MakeAbsPath(file, kernel().bufferFilepath());
+ makeAbsPath(file, kernel().bufferFilepath());
// try to get it from the file, if possible. Zipped files are
// unzipped in the readBB_from_PSFile-Function
bool ControlGraphics::isFilenameValid(string const & fname) const
{
// It may be that the filename is relative.
- string const name = MakeAbsPath(fname, kernel().bufferFilepath());
+ string const name = makeAbsPath(fname, kernel().bufferFilepath());
return isFileReadable(name);
}
vector<string> const getBBUnits()
{
- return vector<string> (bb_units, bb_units + bb_size);
+ return vector<string>(bb_units, bb_units + bb_size);
}
using support::FileFilterList;
using support::isFileReadable;
-using support::MakeAbsPath;
-using support::OnlyPath;
+using support::makeAbsPath;
+using support::onlyPath;
namespace frontend {
pair<string, string> dir1(N_("Documents|#o#O"),
string(lyxrc.document_path));
- string const docpath = OnlyPath(kernel().buffer().fileName());
+ string const docpath = onlyPath(kernel().buffer().fileName());
return browseRelFile(in_name, docpath, title,
filters, false, dir1);
void ControlInclude::load(string const & file)
{
- string const ext = support::GetExtension(file);
+ string const ext = support::getExtension(file);
if (ext == "lyx")
kernel().dispatch(FuncRequest(LFUN_CHILDOPEN, file));
else
bool ControlInclude::fileExists(string const & file)
{
string const fileWithAbsPath
- = MakeAbsPath(file,
- OnlyPath(kernel().buffer().fileName()));
+ = makeAbsPath(file,
+ onlyPath(kernel().buffer().fileName()));
if (isFileReadable(fileWithAbsPath))
return true;
namespace lyx {
using support::compare;
-using support::LibFileSearch;
+using support::libFileSearch;
using support::subst;
namespace frontend {
<< "Looking for math XPM called \""
<< xpm_name << '"' << std::endl;
- return LibFileSearch("images/math/", xpm_name, "xpm");
+ return libFileSearch("images/math/", xpm_name, "xpm");
}
} // namespace frontend
namespace lyx {
-using support::ChangeExtension;
+using support::changeExtension;
using support::FileFilterList;
namespace frontend {
bool ControlPrint::initialiseParams(std::string const &)
{
/// get global printer parameters
- string const name = ChangeExtension(kernel().buffer().fileName(),
+ string const name = changeExtension(kernel().buffer().fileName(),
lyxrc.print_file_extension);
- params_.reset(new PrinterParams (PrinterParams::PRINTER,
- lyxrc.printer, name));
+ params_.reset(new PrinterParams(PrinterParams::PRINTER,
+ lyxrc.printer, name));
dialog().bc().valid(); // so that the user can press Ok
return true;
namespace lyx {
-using support::MakeAbsPath;
-using support::MakeDisplayPath;
+using support::makeAbsPath;
+using support::makeDisplayPath;
namespace frontend {
vector<string> const ControlRef::getLabelList(string const & name) const
{
- Buffer const & buf = *bufferlist.getBuffer(MakeAbsPath(name));
+ Buffer const & buf = *bufferlist.getBuffer(makeAbsPath(name));
vector<string> list;
buf.getLabelList(list);
return list;
vector<string> buffers = bufferlist.getFileNames();
for (vector<string>::iterator it = buffers.begin();
it != buffers.end(); ++it) {
- *it = MakeDisplayPath(*it);
+ *it = makeDisplayPath(*it);
}
return buffers;
namespace lyx {
-using support::AddName;
using support::trim;
namespace frontend {
namespace lyx {
-using support::GetFileContents;
-using support::OnlyFilename;
+using support::onlyFilename;
namespace frontend {
string ControlShowFile::getFileContents()
{
- return GetFileContents(filename_);
+ return support::getFileContents(filename_);
}
string ControlShowFile::getFileName()
{
- return OnlyFilename(filename_);
+ return onlyFilename(filename_);
}
} // namespace frontend
namespace lyx {
-using support::OnlyFilename;
+using support::onlyFilename;
namespace frontend {
vector<string>::iterator it = list.begin();
vector<string>::iterator end = list.end();
for (; it != end; ++it) {
- *it = OnlyFilename(*it);
+ *it = onlyFilename(*it);
}
// sort on filename only (no path)
std::sort(list.begin(), list.end());
namespace lyx {
-using support::AddName;
-using support::ChangeExtension;
+using support::addName;
+using support::changeExtension;
using support::FileFilterList;
-using support::GetExtension;
-using support::LibFileSearch;
-using support::MakeAbsPath;
-using support::MakeRelPath;
-using support::OnlyFilename;
-using support::OnlyPath;
+using support::getExtension;
+using support::libFileSearch;
+using support::makeAbsPath;
+using support::makeRelPath;
+using support::onlyFilename;
+using support::onlyPath;
using support::package;
using support::prefixIs;
{
string lastPath(".");
if (!filename.empty())
- lastPath = OnlyPath(filename);
+ lastPath = onlyPath(filename);
FileDialog fileDlg(title, LFUN_SELECT_FILE_SYNC, dir1, dir2);
if (save)
result = fileDlg.save(lastPath, filters,
- OnlyFilename(filename));
+ onlyFilename(filename));
else
result = fileDlg.open(lastPath, filters,
- OnlyFilename(filename));
+ onlyFilename(filename));
return result.second;
}
pair<string,string> const & dir1,
pair<string,string> const & dir2)
{
- string const fname = MakeAbsPath(filename, refpath);
+ string const fname = makeAbsPath(filename, refpath);
string const outname = browseFile(fname, title, filters, save,
dir1, dir2);
- string const reloutname = MakeRelPath(outname, refpath);
+ string const reloutname = makeRelPath(outname, refpath);
if (prefixIs(reloutname, "../"))
return outname;
else
FileFilterList const & filters)
{
pair<string,string> const dir1(_("System files|#S#s"),
- AddName(package().system_support(), dir));
+ addName(package().system_support(), dir));
pair<string,string> const dir2(_("User files|#U#u"),
- AddName(package().user_support(), dir));
+ addName(package().user_support(), dir));
- string const result = browseFile(LibFileSearch(dir, name, ext), title,
+ string const result = browseFile(libFileSearch(dir, name, ext), title,
filters, false, dir1, dir2);
// remove the extension if it is the default one
string noextresult;
- if (GetExtension(result) == ext)
- noextresult = ChangeExtension(result, string());
+ if (getExtension(result) == ext)
+ noextresult = changeExtension(result, string());
else
noextresult = result;
// remove the directory, if it is the default one
- string const file = OnlyFilename(noextresult);
- if (LibFileSearch(dir, file, ext) == result)
+ string const file = onlyFilename(noextresult);
+ if (libFileSearch(dir, file, ext) == result)
return file;
else
return noextresult;
{
string lastPath(".");
if (!pathname.empty())
- lastPath = OnlyPath(pathname);
+ lastPath = onlyPath(pathname);
FileDialog fileDlg(title, LFUN_SELECT_FILE_SYNC, dir1, dir2);
FileDialog::Result const result =
- fileDlg.opendir(lastPath, OnlyFilename(pathname));
+ fileDlg.opendir(lastPath, onlyFilename(pathname));
return result.second;
}
namespace lyx {
using support::contains;
-using support::GetExtension;
-using support::GetFileContents;
+using support::getExtension;
+using support::getFileContents;
using support::getVectorFromString;
-using support::LibFileSearch;
-using support::OnlyFilename;
+using support::libFileSearch;
+using support::onlyFilename;
using support::package;
using support::Path;
-using support::QuoteName;
+using support::quoteName;
using support::split;
using support::Systemcall;
using support::token;
Systemcall one;
one.startscript(Systemcall::Wait,
"sh " +
- QuoteName(LibFileSearch("scripts", "TeXFiles.sh")));
+ quoteName(libFileSearch("scripts", "TeXFiles.sh")));
}
void getTexFileList(string const & filename, std::vector<string> & list)
{
list.clear();
- string const file = LibFileSearch("", filename);
+ string const file = libFileSearch("", filename);
if (file.empty())
return;
- list = getVectorFromString(GetFileContents(file), "\n");
+ list = getVectorFromString(getFileContents(file), "\n");
// Normalise paths like /foo//bar ==> /foo/bar
boost::RegEx regex("/{2,}");
{
string file_ = file;
// do we need to add the suffix?
- if (!(GetExtension(file) == type))
+ if (!(getExtension(file) == type))
file_ += '.' + type;
lyxerr << "Searching for file " << file_ << endl;
lstfile = "bstFiles.lst";
else if (type == "bib")
lstfile = "bibFiles.lst";
- string const allClasses = GetFileContents(LibFileSearch(string(),
+ string const allClasses = getFileContents(libFileSearch(string(),
lstfile));
int entries = 0;
string classfile = token(allClasses, '\n', entries);
int count = 0;
while ((!contains(classfile, file) ||
- (OnlyFilename(classfile) != file)) &&
+ (onlyFilename(classfile) != file)) &&
(++count < 1000)) {
classfile = token(allClasses, '\n', ++entries);
}
#include <sstream>
-using lyx::support::LibFileSearch;
+using lyx::support::libFileSearch;
using std::ostringstream;
using std::string;
<< controller().getDisclaimer();
dialog->set_license (ls.str());
- string const filename = LibFileSearch("images", "banner", "ppm");
+ string const filename = libFileSearch("images", "banner", "ppm");
Glib::RefPtr<Gdk::Pixbuf> logo = Gdk::Pixbuf::create_from_file(filename);
Glib::RefPtr<Gdk::Pixbuf> logo_scaled = logo->scale_simple(
logo->get_width() / 2,
#include <libglademm.h>
-using lyx::support::ChangeExtension;
+using lyx::support::changeExtension;
using lyx::support::split;
using lyx::support::trim;
vector<string>::const_iterator it = str.begin();
vector<string>::const_iterator const end = str.end();
for (; it != end; ++it) {
- string item(ChangeExtension(*it, ""));
+ string item(changeExtension(*it, ""));
if (item == bibstyle)
item_nr = int(it - str.begin());
stylecombo_.append_text (item);
if (new_bib.empty())
return;
- new_bib = ChangeExtension(new_bib, string());
+ new_bib = changeExtension(new_bib, string());
Gtk::TreeModel::iterator const row = databasesstore_->append();
(*row)[stringcol_] = new_bib;
string const file = controller().browseBst("");
if (!file.empty()) {
- string const filen = ChangeExtension(file, "");
+ string const filen = changeExtension(file, "");
bool present = false;
for (int i = 0; i < stylecombo_.get_model()->children().size(); ++i) {
namespace lyx {
-using support::OnlyFilename;
+using support::onlyFilename;
namespace frontend {
boost::bind(&GMiniBuffer::editMode, minibuffer_.get()));
view_state_changed.connect(boost::bind(&GView::showViewState, this));
signal_focus_in_event().connect(sigc::mem_fun(*this, &GView::onFocusIn));
- //
+ //
int width = 750;
int height = 550;
// first try lyxrc
val = LyX::ref().session().loadSessionInfo("WindowHeight");
if (val != "")
height = convert<unsigned int>(val);
- }
+ }
set_default_size(width, height);
// Make sure the buttons are disabled if needed.
updateToolbars();
string const iconName =
- support::LibFileSearch("images", "lyx", "xpm");
+ support::libFileSearch("images", "lyx", "xpm");
if (!iconName.empty())
set_icon_from_file(iconName);
}
{
doBuild();
string const iconName =
- support::LibFileSearch("images", "lyx", "xpm");
+ support::libFileSearch("images", "lyx", "xpm");
if (!iconName.empty())
window()->set_icon_from_file(iconName);
window()->signal_delete_event().connect(
case LFUN_ITAL: return Gtk::Stock::ITALIC;
case LFUN_FILE_OPEN: return Gtk::Stock::OPEN;
case LFUN_RECONFIGURE: return Gtk::Stock::REFRESH;
- case LFUN_LABEL_GOTO:
+ case LFUN_LABEL_GOTO:
case LFUN_BOOKMARK_GOTO: return Gtk::Stock::JUMP_TO;
case LFUN_GOTONOTE: return Gtk::Stock::GO_FORWARD;
case LFUN_ACCEPT_ALL_CHANGES: return Gtk::Stock::APPLY;
else if (func.argument == "align-right")
return "gtk-justify-right";
break;
-
+
case LFUN_BOOKMARK_SAVE: return "stock_add-bookmark";
case LFUN_INSERT_NOTE: return "stock_insert-note";
case LFUN_LAYOUT_PARAGRAPH: return "stock_format-paragraph";
int iconheight = 16;
Gtk::IconSize::lookup(size, iconwidth, iconheight);
- // TODO: this stuff is called every menu view - needs
+ // TODO: this stuff is called every menu view - needs
// caching somewhere, or maybe GTK does enough of that for us.
Gtk::Image *image = NULL;
Gtk::BuiltinStockID const stockID = getGTKStockIcon(func);
}
}
}
-
+
return image;
}
void unitsComboFromLength(Gtk::ComboBox * combo,
- Gtk::TreeModelColumn<Glib::ustring> const & stringcol,
- LyXLength const & len,
- std::string const & defunit)
+ Gtk::TreeModelColumn<Glib::ustring> const & stringcol,
+ LyXLength const & len,
+ std::string const & defunit)
{
string unit = stringFromUnit(len.unit());
if (unit.empty())
{
// First, search in the installation directories.
- string filename = lyx::support::LibFileSearch("glade", name, "glade");
+ string filename = lyx::support::libFileSearch("glade", name, "glade");
if (!filename.empty())
return filename;
// Second, search in the src tree.
string const dir =
- lyx::support::AddPath(lyx::support::package().top_srcdir(),
+ lyx::support::addPath(lyx::support::package().top_srcdir(),
"src/frontends/gtk/glade");
- filename = lyx::support::ChangeExtension(name, ".glade");
- filename = lyx::support::AddName(dir, filename);
+ filename = lyx::support::changeExtension(name, ".glade");
+ filename = lyx::support::addName(dir, filename);
if (!lyx::support::isFileReadable(filename)) {
lyxerr << "Unable to find glade file \"" << name
#include <boost/assert.hpp>
-using lyx::support::LibFileSearch;
+using lyx::support::libFileSearch;
using std::string;
// insert pixmaps
string bmfile;
- bmfile = LibFileSearch("images", "standard", "xpm");
+ bmfile = libFileSearch("images", "standard", "xpm");
standard_->insertItem(QPixmap(toqstr(bmfile)));
- bmfile = LibFileSearch("images", "amssymb", "xpm");
+ bmfile = libFileSearch("images", "amssymb", "xpm");
maths_->insertItem(QPixmap(toqstr(bmfile)));
- bmfile = LibFileSearch("images", "psnfss1", "xpm");
+ bmfile = libFileSearch("images", "psnfss1", "xpm");
ding1_->insertItem(QPixmap(toqstr(bmfile)));
- bmfile = LibFileSearch("images", "psnfss2", "xpm");
+ bmfile = libFileSearch("images", "psnfss2", "xpm");
ding2_->insertItem(QPixmap(toqstr(bmfile)));
- bmfile = LibFileSearch("images", "psnfss3", "xpm");
+ bmfile = libFileSearch("images", "psnfss3", "xpm");
ding3_->insertItem(QPixmap(toqstr(bmfile)));
- bmfile = LibFileSearch("images", "psnfss4", "xpm");
+ bmfile = libFileSearch("images", "psnfss4", "xpm");
ding4_->insertItem(QPixmap(toqstr(bmfile)));
connect(standard_, SIGNAL(selected(int, int)),
#include <qcheckbox.h>
-using lyx::support::ChangeExtension;
+using lyx::support::changeExtension;
using lyx::support::split;
using lyx::support::trim;
controller().getBibFiles(bib_str);
for (vector<string>::const_iterator it = bib_str.begin();
it != bib_str.end(); ++it) {
- string bibItem(ChangeExtension(*it, ""));
+ string bibItem(changeExtension(*it, ""));
dialog_->add_->bibLB->insertItem(toqstr(bibItem));
}
controller().getBibStyles(str);
for (vector<string>::const_iterator it = str.begin();
it != str.end(); ++it) {
- string item(ChangeExtension(*it, ""));
+ string item(changeExtension(*it, ""));
if (item == bibstyle)
item_nr = int(it - str.begin());
dialog_->styleCB->insertItem(toqstr(item));
#include <qlineedit.h>
#include <qlistbox.h>
-using lyx::support::ChangeExtension;
+using lyx::support::changeExtension;
using lyx::support::trim;
using std::string;
string const file = form_->controller().browseBst("");
if (!file.empty()) {
- string const filen = ChangeExtension(file, "");
+ string const filen = changeExtension(file, "");
bool present = false;
unsigned int pres = 0;
string const file = trim(form_->controller().browseBib(""));
if (!file.empty()) {
- string const f = ChangeExtension(file, "");
+ string const f = changeExtension(file, "");
bool present = false;
for (unsigned int i = 0; i != add_->bibLB->count(); i++) {
}
if (!file.empty()) {
- QString const f = toqstr(ChangeExtension(file, ""));
+ QString const f = toqstr(changeExtension(file, ""));
if ((databaseLB->findItem(f)) == 0)
databaseLB->insertItem(f);
}
#include <qtooltip.h>
#include <qpushbutton.h>
-using lyx::support::LibFileSearch;
+using lyx::support::libFileSearch;
using std::vector;
using std::string;
QCommandBuffer::QCommandBuffer(QtView * view, QWidget * parent, ControlCommandBuffer & control)
: QWidget(parent), view_(view), controller_(control)
{
- QPixmap qpup(toqstr(LibFileSearch("images", "up", "xpm")));
- QPixmap qpdown(toqstr(LibFileSearch("images", "down", "xpm")));
+ QPixmap qpup(toqstr(libFileSearch("images", "up", "xpm")));
+ QPixmap qpdown(toqstr(libFileSearch("images", "down", "xpm")));
QVBoxLayout * top = new QVBoxLayout(this);
QHBoxLayout * layout = new QHBoxLayout(0);
#include <qlistbox.h>
#include <qpushbutton.h>
-using lyx::support::OnlyFilename;
+using lyx::support::onlyFilename;
using std::string;
namespace lyx {
-using support::LibFileSearch;
+using support::libFileSearch;
namespace frontend {
#ifndef Q_WS_MACX
// assign an icon to main form. We do not do it under Qt/Mac,
// since the icon is provided in the application bundle.
- string const iconname = LibFileSearch("images", "lyx", "xpm");
+ string const iconname = libFileSearch("images", "lyx", "xpm");
if (!iconname.empty())
setIcon(QPixmap(toqstr(iconname)));
#endif
#endif
using lyx::support::contains;
-using lyx::support::LibFileSearch;
-using lyx::support::OnlyPath;
-using lyx::support::QuoteName;
+using lyx::support::libFileSearch;
+using lyx::support::onlyPath;
+using lyx::support::quoteName;
using lyx::support::Systemcall;
using std::endl;
#include <boost/bind.hpp>
#include <boost/signals/trackable.hpp>
-using lyx::support::LibFileSearch;
+using lyx::support::libFileSearch;
using std::endl;
using std::min;
if (!lyxrc.show_banner)
return;
- string const file = LibFileSearch("images", "banner", "ppm");
+ string const file = libFileSearch("images", "banner", "ppm");
if (file.empty())
return;
namespace lyx {
-using support::ChangeExtension;
+using support::changeExtension;
using support::compare;
using support::FileFilterList;
using support::getStringFromVector;
using support::getVectorFromString;
-using support::OnlyFilename;
+using support::onlyFilename;
using support::split;
namespace frontend {
return ButtonPolicy::SMI_NOOP;
} else {
fl_set_input(dialog_->input_style,
- ChangeExtension(style, "").c_str());
+ changeExtension(style, "").c_str());
}
// reset the browser so that the following
// single-click callback doesn't do anything
vector<string> dbase = getVectorFromString(str_in);
for (vector<string>::iterator it = dbase.begin();
it != dbase.end(); ++it) {
- *it = ChangeExtension(*it, string());
+ *it = changeExtension(*it, string());
}
eliminate_duplicates(dbase);
return getStringFromVector(dbase);
string bibstyle = getString(dialog_->input_style);
if (!bibstyle.empty()) {
// save the BibTeX style without any ".bst" extension
- bibstyle = ChangeExtension(OnlyFilename(bibstyle), "");
+ bibstyle = changeExtension(onlyFilename(bibstyle), "");
}
bool const addtotoc = fl_get_button(dialog_->check_bibtotoc);
// assign an icon to the form
string const iconname =
- support::LibFileSearch("images", "lyx", "xpm");
+ support::libFileSearch("images", "lyx", "xpm");
if (!iconname.empty()) {
unsigned int w, h;
namespace lyx {
using support::bformat;
-using support::LibFileSearch;
+using support::libFileSearch;
namespace frontend {
fl_winicontitle(form()->window, getTitle().c_str());
// assign an icon to the form
- string const iconname = LibFileSearch("images", "lyx", "xpm");
+ string const iconname = libFileSearch("images", "lyx", "xpm");
if (!iconname.empty()) {
unsigned int w, h;
icon_pixmap_ = fl_read_pixmapfile(fl_root,
using support::contains;
using support::getStringFromVector;
using support::getVectorFromString;
-using support::LibFileSearch;
+using support::libFileSearch;
namespace frontend {
fl_set_input_maxchars(bullets_->input_latex, 80);
- string const bmtablefile = LibFileSearch("images", "standard", "xpm");
+ string const bmtablefile = libFileSearch("images", "standard", "xpm");
fl_set_bmtable_pixmap_file(bullets_->bmtable_panel, 6, 6,
bmtablefile.c_str());
}
new_panel += ".xpm";
fl_set_bmtable_pixmap_file(bullets_->bmtable_panel, 6, 6,
- LibFileSearch("images", new_panel).c_str());
+ libFileSearch("images", new_panel).c_str());
fl_redraw_object(bullets_->bmtable_panel);
fl_unfreeze_form(bullets_->form);
}
#include <algorithm>
#include <sstream>
-using lyx::support::AbsolutePath;
-using lyx::support::AddName;
-using lyx::support::ExpandPath;
+using lyx::support::absolutePath;
+using lyx::support::addName;
+using lyx::support::expandPath;
using lyx::support::FileFilterList;
using lyx::support::getcwd;
-using lyx::support::MakeAbsPath;
-using lyx::support::OnlyFilename;
+using lyx::support::makeAbsPath;
+using lyx::support::onlyFilename;
using lyx::support::package;
using lyx::support::split;
using lyx::support::suffixIs;
if (path.empty())
tmp = getcwd();
else
- tmp = MakeAbsPath(ExpandPath(path), directory_);
+ tmp = makeAbsPath(expandPath(path), directory_);
// must check the directory exists
if (!fs::exists(tmp) || !fs::is_directory(tmp)) {
FileDialog::Private::Private()
{
- directory_ = MakeAbsPath(string("."));
+ directory_ = makeAbsPath(string("."));
// Creates form if necessary.
if (!file_dlg_form_) {
// highlight the suggested file in the browser, if it exists.
int sel = 0;
- string const filename = OnlyFilename(suggested);
+ string const filename = onlyFilename(suggested);
if (!filename.empty()) {
for (int i = 0; i < fl_get_browser_maxline(file_dlg_form_->List); ++i) {
string s = fl_get_browser_line(file_dlg_form_->List, i + 1);
file_name_ = fl_get_input(file_dlg_form_->Filename);
- if (!AbsolutePath(file_name_))
- file_name_ = AddName(fl_get_input(file_dlg_form_->DirBox), file_name_);
+ if (!absolutePath(file_name_))
+ file_name_ = addName(fl_get_input(file_dlg_form_->DirBox), file_name_);
return file_name_;
}
namespace lyx {
-using support::AddName;
-using support::ChangeExtension;
+using support::addName;
+using support::changeExtension;
using support::package;
using support::rtrim;
using support::trim;
// The "Save" button has been pressed.
if (dialog().isClosing() && colors_.modifiedXformsPrefs) {
string const filename =
- AddName(package().user_support(), "preferences.xform");
+ addName(package().user_support(), "preferences.xform");
colors_.modifiedXformsPrefs = !XformsColor::write(filename);
}
}
string const name = getString(dialog_->input_serverpipe);
if (!name.empty()) {
// strip off the extension
- string const str = ChangeExtension(name, "");
+ string const str = changeExtension(name, "");
if (!RWInfo::WriteableFile(str + ".in")) {
parent_.postWarning(RWInfo::ErrorMessage());
return false;
namespace lyx {
-using support::OnlyFilename;
-
namespace frontend {
namespace lyx {
-using support::LibFileSearch;
+using support::libFileSearch;
namespace frontend {
minibuffer_.reset(new XMiniBuffer(*this, *controlcommand_));
// Assign an icon to the main form.
- string const iconname = LibFileSearch("images", "lyx", "xpm");
+ string const iconname = libFileSearch("images", "lyx", "xpm");
if (!iconname.empty()) {
unsigned int w, h;
icon_pixmap_ = fl_read_pixmapfile(fl_root,
#include <sstream>
#include <iomanip>
-using lyx::support::AddName;
+using lyx::support::addName;
using lyx::support::package;
using lyx::frontend::fontloader;
void parse_lyxrc()
{
- XformsColor::read(AddName(package().user_support(),
+ XformsColor::read(addName(package().user_support(),
"preferences.xform"));
if (lyxrc.popup_font_encoding.empty())
namespace lyx {
-using support::LibFileSearch;
-using support::OnlyPath;
using support::Systemcall;
namespace frontend {
namespace lyx {
-using support::AbsolutePath;
+using support::absolutePath;
using support::isStrDbl;
-using support::OnlyPath;
+using support::onlyPath;
using support::subst;
using support::trim;
{
error_message.erase();
- if (!AbsolutePath(name)) {
+ if (!absolutePath(name)) {
error_message = _("The absolute path is required.");
return false;
}
{
error_message.erase();
- if (!AbsolutePath(name)) {
+ if (!absolutePath(name)) {
error_message = _("The absolute path is required.");
return false;
}
return false;
}
- string const dir = OnlyPath(name);
- if (!AbsolutePath(dir)) {
+ string const dir = onlyPath(name);
+ if (!absolutePath(dir)) {
error_message = _("The absolute path is required.");
return false;
}
return false;
}
- string const dir = OnlyPath(name);
- if (!AbsolutePath(dir)) {
+ string const dir = onlyPath(name);
+ if (!absolutePath(dir)) {
error_message = _("The absolute path is required.");
return false;
}
void Cache::add(string const & file) const
{
- if (!support::AbsolutePath(file)) {
+ if (!support::absolutePath(file)) {
lyxerr << "Cache::add(" << file << "):\n"
<< "The file must be have an absolute path."
<< std::endl;
namespace support = lyx::support;
-using support::ChangeExtension;
+using support::changeExtension;
using support::FileMonitor;
using support::isFileReadable;
-using support::MakeDisplayPath;
-using support::OnlyFilename;
+using support::makeDisplayPath;
+using support::onlyFilename;
using support::tempName;
using support::unlink;
using support::unzipFile;
} else
filename = filename_;
- string const displayed_filename = MakeDisplayPath(filename_);
+ string const displayed_filename = makeDisplayPath(filename_);
lyxerr[Debug::GRAPHICS] << "[GrahicsCacheItem::convertToDisplayFormat]\n"
<< "\tAttempting to convert image file: " << filename
<< "\n\twith displayed filename: " << displayed_filename
lyxerr[Debug::GRAPHICS] << "\tConverting it to " << to << " format." << endl;
// Take only the filename part of the file, without path or extension.
- string const temp = ChangeExtension(OnlyFilename(filename), string());
+ string const temp = changeExtension(onlyFilename(filename), string());
// Add some stuff to create a uniquely named temporary file.
// This file is deleted in loadImage after it is loaded into memory.
namespace support = lyx::support;
-using support::ChangeExtension;
+using support::changeExtension;
using support::Forkedcall;
using support::ForkedCallQueue;
-using support::LibFileSearch;
-using support::LibScriptSearch;
-using support::OnlyPath;
-using support::OnlyFilename;
-using support::QuoteName;
+using support::libFileSearch;
+using support::libScriptSearch;
+using support::onlyPath;
+using support::onlyFilename;
+using support::quoteName;
using support::subst;
using support::tempName;
using support::unlink;
if (!success) {
script_command_ =
"sh " +
- QuoteName(LibFileSearch("scripts", "convertDefault.sh")) +
+ quoteName(libFileSearch("scripts", "convertDefault.sh")) +
' ' +
- QuoteName((from_format.empty() ? "" : from_format + ':') + from_file) +
+ quoteName((from_format.empty() ? "" : from_format + ':') + from_file) +
' ' +
- QuoteName(to_format + ':' + to_file_);
+ quoteName(to_format + ':' + to_file_);
lyxerr[Debug::GRAPHICS]
<< "\tNo converter defined! I use convertDefault.sh\n\t"
// Output the script to file.
static int counter = 0;
- script_file_ = OnlyPath(to_file_base) + "lyxconvert" +
+ script_file_ = onlyPath(to_file_base) + "lyxconvert" +
convert<string>(counter++) + ".sh";
std::ofstream fs(script_file_.c_str());
// We create a dummy command for ease of understanding of the
// list of forked processes.
// Note: 'sh ' is absolutely essential, or execvp will fail.
- script_command_ = "sh " + QuoteName(script_file_) + ' ' +
- QuoteName(OnlyFilename(from_file)) + ' ' +
- QuoteName(to_format);
+ script_command_ = "sh " + quoteName(script_file_) + ' ' +
+ quoteName(onlyFilename(from_file)) + ' ' +
+ quoteName(to_format);
}
// All is ready to go
valid_process_ = true;
+ formats.extension(to_format);
if (from_format == to_format) {
- script << move_file(QuoteName(from_file), QuoteName(to_file));
+ script << move_file(quoteName(from_file), quoteName(to_file));
lyxerr[Debug::GRAPHICS] << "ready (from == to)" << endl;
return true;
}
// Build the conversion command
string const infile = outfile;
- string const infile_base = ChangeExtension(infile, string());
- outfile = ChangeExtension(to_base, conv.To->extension());
+ string const infile_base = changeExtension(infile, string());
+ outfile = changeExtension(to_base, conv.To->extension());
// Store these names in the shell script
- script << "infile=" << QuoteName(infile) << '\n'
- << "infile_base=" << QuoteName(infile_base) << '\n'
- << "outfile=" << QuoteName(outfile) << '\n';
+ script << "infile=" << quoteName(infile) << '\n'
+ << "infile_base=" << quoteName(infile_base) << '\n'
+ << "outfile=" << quoteName(outfile) << '\n';
string command = conv.command;
command = subst(command, token_from, "\"${infile}\"");
command = subst(command, token_base, "\"${infile_base}\"");
command = subst(command, token_to, "\"${outfile}\"");
- command = LibScriptSearch(command);
+ command = libScriptSearch(command);
// Store in the shell script
script << "\n" << command << " ||\n";
}
// Move the final outfile to to_file
- script << move_file("\"${outfile}\"", QuoteName(to_file));
+ script << move_file("\"${outfile}\"", quoteName(to_file));
lyxerr[Debug::GRAPHICS] << "ready!" << endl;
return true;
// The conversion command.
ostringstream cs;
cs << pconverter_->command << ' ' << pconverter_->to << ' '
- << support::QuoteName(latexfile) << ' '
+ << support::quoteName(latexfile) << ' '
<< int(font_scaling_factor_) << ' '
<< lyx_gui::hexname(LColor::preview) << ' '
<< lyx_gui::hexname(LColor::background);
- string const command = support::LibScriptSearch(cs.str());
+ string const command = support::libScriptSearch(cs.str());
// Initiate the conversion from LaTeX to bitmap images files.
support::Forkedcall::SignalTypePtr
{
static int theCounter = 0;
string const filename = convert<string>(theCounter++) + "lyxpreview";
- return support::AddName(bufferpath, filename);
+ return support::addName(bufferpath, filename);
}
#include "BufferView.h"
using lyx::support::bformat;
-using lyx::support::ChangeExtension;
-using lyx::support::MakeDisplayPath;
+using lyx::support::changeExtension;
+using lyx::support::makeDisplayPath;
using std::find;
using std::string;
bool Importer::Import(LyXView * lv, string const & filename,
string const & format)
{
- string const displaypath = MakeDisplayPath(filename);
+ string const displaypath = makeDisplayPath(filename);
lv->message(bformat(_("Importing %1$s..."), displaypath));
- string const lyxfile = ChangeExtension(filename, ".lyx");
+ string const lyxfile = changeExtension(filename, ".lyx");
string loader_format;
vector<string> loaders = Loaders();
lv->view()->newFile(lyxfile, string(), true);
bool as_paragraphs = loader_format == "textparagraph";
string filename2 = (loader_format == format) ? filename
- : ChangeExtension(filename,
+ : changeExtension(filename,
formats.extension(loader_format));
InsertAsciiFile(lv->view().get(), filename2, as_paragraphs);
lv->dispatch(FuncRequest(LFUN_MARK_OFF));
string const filename = external_in_tmpdir ?
params.filename.mangledFilename() :
params.filename.outputFilename(parentpath);
- string const basename = support::ChangeExtension(
- support::OnlyFilename(filename), string());
- string const absname = support::MakeAbsPath(filename, parentpath);
+ string const basename = support::changeExtension(
+ support::onlyFilename(filename), string());
+ string const absname = support::makeAbsPath(filename, parentpath);
string result = s;
if (what != ALL_BUT_PATHS) {
- string const filepath = support::OnlyPath(filename);
- string const abspath = support::OnlyPath(absname);
+ string const filepath = support::onlyPath(filename);
+ string const abspath = support::onlyPath(absname);
string const masterpath = external_in_tmpdir ?
m_buffer->temppath() :
m_buffer->filePath();
- string relToMasterPath = support::OnlyPath(
- support::MakeRelPath(absname, masterpath));
+ string relToMasterPath = support::onlyPath(
+ support::makeRelPath(absname, masterpath));
if (relToMasterPath == "./")
relToMasterPath.clear();
- string relToParentPath = support::OnlyPath(
- support::MakeRelPath(absname, parentpath));
+ string relToParentPath = support::onlyPath(
+ support::makeRelPath(absname, parentpath));
if (relToParentPath == "./")
relToParentPath.clear();
relToParentPath, use_latex_path,
support::PROTECT_EXTENSION,
support::ESCAPE_DOTS);
- if (support::AbsolutePath(filename)) {
+ if (support::absolutePath(filename)) {
result = subst_path(result, "$$AbsOrRelPathMaster",
abspath, use_latex_path,
support::PROTECT_EXTENSION,
result = subst_path(result, "$$Basename", basename, use_latex_path,
support::PROTECT_EXTENSION, support::ESCAPE_DOTS);
result = subst_path(result, "$$Extension",
- '.' + support::GetExtension(filename), use_latex_path);
+ '.' + support::getExtension(filename), use_latex_path);
result = subst_path(result, "$$Tempname", params.tempname(), use_latex_path);
result = subst_path(result, "$$Sysdir",
support::package().system_support(), use_latex_path);
support::Path p(filepath);
if (support::isFileReadable(file))
- contents = support::GetFileContents(file);
+ contents = support::getFileContents(file);
result = support::subst(result,
("$$Contents(\"" + file + "\")").c_str(),
// We copy the source file to the temp dir and do the conversion
// there if necessary
string const temp_file =
- support::MakeAbsPath(params.filename.mangledFilename(),
+ support::makeAbsPath(params.filename.mangledFilename(),
m_buffer->temppath());
if (!abs_from_file.empty()) {
unsigned long const from_checksum = support::sum(abs_from_file);
outputFormat.updateResult,
false, true);
string const abs_to_file =
- support::MakeAbsPath(to_file, m_buffer->temppath());
+ support::makeAbsPath(to_file, m_buffer->temppath());
// Record the referenced files for the exporter.
// The exporter will copy them to the export dir.
vector<string>::const_iterator fit = rit->second.begin();
vector<string>::const_iterator fend = rit->second.end();
for (; fit != fend; ++fit) {
- string const source = support::MakeAbsPath(
+ string const source = support::makeAbsPath(
doSubstitution(params, buffer, *fit,
false, true),
m_buffer->temppath());
if (support::compare_timestamps(temp_file, abs_to_file) < 0)
return; // SUCCESS
string const to_file_base =
- support::ChangeExtension(to_file, string());
+ support::changeExtension(to_file, string());
/* bool const success = */
converters.convert(&buffer, temp_file, to_file_base,
from_format, to_format, true);
LyXLex lex(templatetags, TM_TEMPLATE_END);
- string filename = support::LibFileSearch("", "external_templates");
+ string filename = support::libFileSearch("", "external_templates");
if (filename.empty() || !lex.setFile(filename)) {
lex.printError("external::TemplateManager::readTemplates: "
"No template file");
#include <fstream>
#include <sstream>
-using lyx::support::AbsolutePath;
+using lyx::support::absolutePath;
using lyx::support::ascii_lowercase;
-using lyx::support::ChangeExtension;
+using lyx::support::changeExtension;
using lyx::support::contains;
using lyx::support::copy;
using lyx::support::FileName;
using lyx::support::isFileReadable;
using lyx::support::latex_path;
using lyx::support::ltrim;
-using lyx::support::MakeAbsPath;
-using lyx::support::MakeRelPath;
+using lyx::support::makeAbsPath;
+using lyx::support::makeRelPath;
using lyx::support::Path;
using lyx::support::prefixIs;
using lyx::support::removeExtension;
string normalize_name(Buffer const & buffer, OutputParams const & runparams,
string const & name, string const & ext)
{
- string const fname = MakeAbsPath(name, buffer.filePath());
- if (AbsolutePath(name) || !isFileReadable(fname + ext))
+ string const fname = makeAbsPath(name, buffer.filePath());
+ if (absolutePath(name) || !isFileReadable(fname + ext))
return name;
else if (!runparams.nice)
return fname;
else
- return MakeRelPath(fname, buffer.getMasterBuffer()->filePath());
+ return makeRelPath(fname, buffer.getMasterBuffer()->filePath());
}
}
// mangledFilename() needs the extension
database = removeExtension(FileName(in_file).mangledFilename());
- string const out_file = MakeAbsPath(database + ".bib",
+ string const out_file = makeAbsPath(database + ".bib",
buffer.getMasterBuffer()->temppath());
bool const success = copy(in_file, out_file);
// use new style name
base = removeExtension(
FileName(in_file).mangledFilename());
- string const out_file = MakeAbsPath(base + ".bst",
+ string const out_file = makeAbsPath(base + ".bst",
buffer.getMasterBuffer()->temppath());
bool const success = copy(in_file, out_file);
if (!success) {
string bibfiles = getContents();
bibfiles = split(bibfiles, tmp, ',');
while (!tmp.empty()) {
- string file = findtexfile(ChangeExtension(tmp, "bib"), "bib");
+ string file = findtexfile(changeExtension(tmp, "bib"), "bib");
lyxerr[Debug::LATEX] << "Bibfile: " << file << endl;
// If we didn't find a matching file name just fail silently
namespace support = lyx::support;
-using lyx::support::AbsolutePath;
+using lyx::support::absolutePath;
using lyx::support::bformat;
-using lyx::support::ChangeExtension;
+using lyx::support::changeExtension;
using lyx::support::compare_timestamps;
using lyx::support::contains;
using lyx::support::FileName;
using lyx::support::float_equal;
-using lyx::support::GetExtension;
+using lyx::support::getExtension;
using lyx::support::isFileReadable;
using lyx::support::latex_path;
-using lyx::support::OnlyFilename;
+using lyx::support::onlyFilename;
using lyx::support::removeExtension;
using lyx::support::rtrim;
using lyx::support::subst;
std::pair<CopyStatus, string> const
copyFileIfNeeded(string const & file_in, string const & file_out)
{
- BOOST_ASSERT(AbsolutePath(file_in));
- BOOST_ASSERT(AbsolutePath(file_out));
+ BOOST_ASSERT(absolutePath(file_in));
+ BOOST_ASSERT(absolutePath(file_out));
unsigned long const checksum_in = support::sum(file_in);
unsigned long const checksum_out = support::sum(file_out);
{
using support::rtrim;
- BOOST_ASSERT(AbsolutePath(file_in));
+ BOOST_ASSERT(absolutePath(file_in));
- string const only_path = support::OnlyPath(file_in);
- if (rtrim(support::OnlyPath(file_in) , "/") == rtrim(dir, "/"))
+ string const only_path = support::onlyPath(file_in);
+ if (rtrim(support::onlyPath(file_in) , "/") == rtrim(dir, "/"))
return std::make_pair(IDENTICAL_PATHS, file_in);
string mangled = FileName(file_in).mangledFilename();
string::size_type const ext_len = file_in.length() - base.length();
mangled[mangled.length() - ext_len] = '.';
}
- string const file_out = support::MakeAbsPath(mangled, dir);
+ string const file_out = support::makeAbsPath(mangled, dir);
return copyFileIfNeeded(file_in, file_out);
}
// No conversion is needed. LaTeX can handle the graphic file as is.
// This is true even if the orig_file is compressed.
string const to_format = formats.getFormat(to)->extension();
- string const file_format = GetExtension(file);
+ string const file_format = getExtension(file);
// for latex .ps == .eps
if (to_format == file_format ||
(to_format == "eps" && file_format == "ps") ||
// run through the LaTeX compiler.
string output_file = os::external_path(runparams.nice ?
params().filename.outputFilename(m_buffer->filePath()) :
- OnlyFilename(temp_file));
+ onlyFilename(temp_file));
string source_file = runparams.nice ? orig_file : temp_file;
string const tex_format = (runparams.flavor == OutputParams::LATEX) ?
"latex" : "pdflatex";
lyxerr[Debug::GRAPHICS]
<< "\tpass zipped file to LaTeX.\n";
- string const bb_orig_file = ChangeExtension(orig_file, "bb");
+ string const bb_orig_file = changeExtension(orig_file, "bb");
if (runparams.nice) {
runparams.exportdata->addExternalFile(tex_format,
bb_orig_file,
- ChangeExtension(output_file, "bb"));
+ changeExtension(output_file, "bb"));
} else {
// LaTeX needs the bounding box file in the
// tmp dir
- string bb_file = ChangeExtension(temp_file, "bb");
+ string bb_file = changeExtension(temp_file, "bb");
boost::tie(status, bb_file) =
copyFileIfNeeded(bb_orig_file, bb_file);
if (status == FAILURE)
return stripExtensionIfPossible(output_file, to);
}
- string const to_file = ChangeExtension(temp_file, ext);
- string const output_to_file = ChangeExtension(output_file, ext);
+ string const to_file = changeExtension(temp_file, ext);
+ string const output_to_file = changeExtension(output_file, ext);
// Do we need to perform the conversion?
// Yes if to_file does not exist or if temp_file is newer than to_file
#include <sstream>
-using lyx::support::AddName;
-using lyx::support::AbsolutePath;
+using lyx::support::addName;
+using lyx::support::absolutePath;
using lyx::support::bformat;
-using lyx::support::ChangeExtension;
+using lyx::support::changeExtension;
using lyx::support::contains;
using lyx::support::copy;
using lyx::support::FileName;
-using lyx::support::GetFileContents;
+using lyx::support::getFileContents;
using lyx::support::isFileReadable;
using lyx::support::isLyXFilename;
using lyx::support::latex_path;
-using lyx::support::MakeAbsPath;
-using lyx::support::MakeDisplayPath;
-using lyx::support::MakeRelPath;
-using lyx::support::OnlyFilename;
-using lyx::support::OnlyPath;
+using lyx::support::makeAbsPath;
+using lyx::support::makeDisplayPath;
+using lyx::support::makeRelPath;
+using lyx::support::onlyFilename;
+using lyx::support::onlyPath;
using lyx::support::subst;
using lyx::support::sum;
string const includedFilename(Buffer const & buffer,
InsetCommandParams const & params)
{
- return MakeAbsPath(params.getContents(),
- OnlyPath(parentFilename(buffer)));
+ return makeAbsPath(params.getContents(),
+ onlyPath(parentFilename(buffer)));
}
if (params_.getContents().empty())
temp += "???";
else
- temp += OnlyFilename(params_.getContents());
+ temp += onlyFilename(params_.getContents());
return temp;
}
// if incfile is relative, make it relative to the master
// buffer directory.
- if (!AbsolutePath(incfile)) {
- incfile = MakeRelPath(included_file,
+ if (!absolutePath(incfile)) {
+ incfile = makeRelPath(included_file,
m_buffer->filePath());
}
// write it to a file (so far the complete file)
- string const exportfile = ChangeExtension(incfile, ".tex");
- string const mangled = FileName(ChangeExtension(included_file,
+ string const exportfile = changeExtension(incfile, ".tex");
+ string const mangled = FileName(changeExtension(included_file,
".tex")).mangledFilename();
- string const writefile = MakeAbsPath(mangled, m_buffer->temppath());
+ string const writefile = makeAbsPath(mangled, m_buffer->temppath());
if (!runparams.nice)
incfile = mangled;
string text = bformat(_("Included file `%1$s'\n"
"has textclass `%2$s'\n"
"while parent file has textclass `%3$s'."),
- MakeDisplayPath(included_file),
+ makeDisplayPath(included_file),
tmp->params().getLyXTextClass().name(),
m_buffer->params().getLyXTextClass().name());
Alert::warning(_("Different textclasses"), text);
// make use of it somehow? (JMarc 20031002)
#endif
tmp->makeLaTeXFile(writefile,
- OnlyPath(masterFilename(buffer)),
+ onlyPath(masterFilename(buffer)),
runparams, false);
} else {
// Copy the file to the temp dir, so that .aux files etc.
incfile = latex_path(incfile);
os << '\\' << params_.getCmdName() << '{' << incfile << '}';
} else {
- incfile = ChangeExtension(incfile, ".tex");
+ incfile = changeExtension(incfile, ".tex");
incfile = latex_path(incfile);
os << '\\' << params_.getCmdName() << '{'
<< incfile
// \include don't want extension and demands that the
// file really have .tex
- incfile = ChangeExtension(incfile, string());
+ incfile = changeExtension(incfile, string());
incfile = latex_path(incfile);
os << '\\' << params_.getCmdName() << '{'
<< incfile
OutputParams const &) const
{
if (isVerbatim(params_))
- os << GetFileContents(includedFilename(buffer, params_));
+ os << getFileContents(includedFilename(buffer, params_));
return 0;
}
string const included_file = includedFilename(buffer, params_);
// write it to a file (so far the complete file)
- string const exportfile = ChangeExtension(incfile, ".sgml");
- string writefile = ChangeExtension(included_file, ".sgml");
+ string const exportfile = changeExtension(incfile, ".sgml");
+ string writefile = changeExtension(included_file, ".sgml");
if (loadIfNeeded(buffer, params_)) {
Buffer * tmp = bufferlist.getBuffer(included_file);
- writefile = MakeAbsPath(FileName(writefile).mangledFilename(),
+ writefile = makeAbsPath(FileName(writefile).mangledFilename(),
buffer.getMasterBuffer()->temppath());
if (!runparams.nice)
incfile = writefile;
if (isVerbatim(params_)) {
os << "<![CDATA["
- << GetFileContents(included_file)
+ << getFileContents(included_file)
<< "]]>";
} else {
runparams.exportdata->addExternalFile("linuxdoc", writefile,
string const included_file = includedFilename(buffer, params_);
// write it to a file (so far the complete file)
- string const exportfile = ChangeExtension(incfile, ".sgml");
- string writefile = ChangeExtension(included_file, ".sgml");
+ string const exportfile = changeExtension(incfile, ".sgml");
+ string writefile = changeExtension(included_file, ".sgml");
if (loadIfNeeded(buffer, params_)) {
Buffer * tmp = bufferlist.getBuffer(included_file);
string const mangled = FileName(writefile).mangledFilename();
- writefile = MakeAbsPath(mangled,
+ writefile = makeAbsPath(mangled,
buffer.getMasterBuffer()->temppath());
if (!runparams.nice)
incfile = mangled;
string const included_file = includedFilename(buffer, params_);
if (isLyXFilename(included_file))
- writefile = ChangeExtension(included_file, ".sgml");
+ writefile = changeExtension(included_file, ".sgml");
else
writefile = included_file;
if (!features.runparams().nice && !isVerbatim(params_)) {
incfile = FileName(writefile).mangledFilename();
- writefile = MakeAbsPath(incfile,
+ writefile = makeAbsPath(incfile,
buffer.getMasterBuffer()->temppath());
}
namespace graphics = lyx::graphics;
-using lyx::support::AbsolutePath;
-using lyx::support::OnlyFilename;
+using lyx::support::absolutePath;
+using lyx::support::onlyFilename;
using std::string;
using std::auto_ptr;
params_ = params;
if (!params_.filename.empty()) {
- BOOST_ASSERT(AbsolutePath(params_.filename));
+ BOOST_ASSERT(absolutePath(params_.filename));
loader_.reset(params_.filename, params_);
}
}
LyXFont msgFont(mi.base.font);
msgFont.setFamily(LyXFont::SANS_FAMILY);
- string const justname = OnlyFilename(params_.filename);
+ string const justname = onlyFilename(params_.filename);
if (!justname.empty()) {
msgFont.setSize(LyXFont::SIZE_FOOTNOTE);
font_width = font_metrics::width(justname, msgFont);
// Print the file name.
LyXFont msgFont = pi.base.font;
msgFont.setFamily(LyXFont::SANS_FAMILY);
- string const justname = OnlyFilename(params_.filename);
+ string const justname = onlyFilename(params_.filename);
if (!justname.empty()) {
msgFont.setSize(LyXFont::SIZE_FOOTNOTE);
#include <cerrno>
#include <fstream>
-using lyx::support::AddName;
+using lyx::support::addName;
using lyx::support::bformat;
using lyx::support::destroyDir;
using lyx::support::FileFilterList;
using lyx::support::ForkedProcess;
using lyx::support::isLyXFilename;
-using lyx::support::LibFileSearch;
-using lyx::support::MakeAbsPath;
-using lyx::support::MakeDisplayPath;
-using lyx::support::OnlyFilename;
-using lyx::support::OnlyPath;
+using lyx::support::libFileSearch;
+using lyx::support::makeAbsPath;
+using lyx::support::makeDisplayPath;
+using lyx::support::onlyFilename;
+using lyx::support::onlyPath;
using lyx::support::Path;
using lyx::support::package;
-using lyx::support::QuoteName;
+using lyx::support::quoteName;
using lyx::support::removeAutosaveFile;
using lyx::support::rename;
using lyx::support::split;
// FIXME: we don't tell the user *WHY* the save failed !!
- string const file = MakeDisplayPath(buffer->fileName(), 30);
+ string const file = makeDisplayPath(buffer->fileName(), 30);
string text = bformat(_("The document %1$s could not be saved.\n\n"
"Do you want to rename the document and try again?"), file);
FileFilterList const filter (_("LyX Documents (*.lyx)"));
FileDialog::Result result =
- fileDlg.save(OnlyPath(fname),
+ fileDlg.save(onlyPath(fname),
filter,
- OnlyFilename(fname));
+ onlyFilename(fname));
if (result.first == FileDialog::Later)
return false;
return false;
// Make sure the absolute filename ends with appropriate suffix
- fname = MakeAbsPath(fname);
+ fname = makeAbsPath(fname);
if (!isLyXFilename(fname))
fname += ".lyx";
} else
fname = filename;
if (fs::exists(fname)) {
- string const file = MakeDisplayPath(fname, 30);
+ string const file = makeDisplayPath(fname, 30);
string text = bformat(_("The document %1$s already exists.\n\n"
"Do you want to over-write that document?"), file);
int const ret = Alert::prompt(_("Over-write document?"),
// create autosave filename
string fname = bv->buffer()->filePath();
fname += '#';
- fname += OnlyFilename(bv->buffer()->fileName());
+ fname += onlyFilename(bv->buffer()->fileName());
fname += '#';
AutoSaveBuffer autosave(*bv, fname);
if (!fs::is_readable(fname)) {
string const error = strerror(errno);
- string const file = MakeDisplayPath(fname, 50);
+ string const file = makeDisplayPath(fname, 50);
string const text = bformat(_("Could not read the specified document\n"
"%1$s\ndue to the error: %2$s"), file, error);
Alert::error(_("Could not read file"), text);
ifstream ifs(fname.c_str());
if (!ifs) {
string const error = strerror(errno);
- string const file = MakeDisplayPath(fname, 50);
+ string const file = makeDisplayPath(fname, 50);
string const text = bformat(_("Could not open the specified document\n"
"%1$s\ndue to the error: %2$s"), file, error);
Alert::error(_("Could not open file"), text);
// Run configure in user lyx directory
Path p(package().user_support());
string const configure_script =
- AddName(package().system_support(), "configure.py");
- string const configure_command = "python " + QuoteName(configure_script);
+ addName(package().system_support(), "configure.py");
+ string const configure_command = "python " + quoteName(configure_script);
Systemcall one;
one.startscript(Systemcall::Wait, configure_command);
p.pop();
bv->owner()->message(_("Reloading configuration..."));
- lyxrc.read(LibFileSearch(string(), "lyxrc.defaults"));
+ lyxrc.read(libFileSearch(string(), "lyxrc.defaults"));
// Re-read packages.lst
LaTeXFeatures::getAvailable();
#include <iostream>
#include <csignal>
-using lyx::support::AddName;
-using lyx::support::AddPath;
+using lyx::support::addName;
+using lyx::support::addPath;
using lyx::support::bformat;
using lyx::support::createDirectory;
using lyx::support::createLyXTmpDir;
-using lyx::support::FileSearch;
+using lyx::support::fileSearch;
using lyx::support::getEnv;
using lyx::support::i18nLibFileSearch;
-using lyx::support::LibFileSearch;
+using lyx::support::libFileSearch;
using lyx::support::package;
using lyx::support::Path;
using lyx::support::prependEnvPath;
-using lyx::support::QuoteName;
+using lyx::support::quoteName;
using lyx::support::rtrim;
namespace os = lyx::support::os;
void reconfigureUserLyXDir()
{
string const configure_script =
- AddName(package().system_support(), "configure.py");
+ addName(package().system_support(), "configure.py");
string const configure_command =
- "python " + QuoteName(configure_script);
+ "python " + quoteName(configure_script);
lyxerr << _("LyX: reconfiguring user directory") << endl;
Path p(package().user_support());
for (; it != end; ++it) {
// get absolute path of file and add ".lyx" to
// the filename if necessary
- string s = FileSearch(string(), *it, "lyx");
+ string s = fileSearch(string(), *it, "lyx");
if (s.empty()) {
last_loaded = newFile(*it, string(), true);
} else {
lyxrc.document_path = package().document_dir();
if (lyxrc.template_path.empty()) {
- lyxrc.template_path = AddPath(package().system_support(),
+ lyxrc.template_path = addPath(package().system_support(),
"templates");
}
string prefsfile = "preferences";
// back compatibility to lyxs < 1.1.6
- if (LibFileSearch(string(), prefsfile).empty())
+ if (libFileSearch(string(), prefsfile).empty())
prefsfile = "lyxrc";
- if (!LibFileSearch(string(), prefsfile).empty())
+ if (!libFileSearch(string(), prefsfile).empty())
readRcFile(prefsfile);
readEncodingsFile("encodings");
fs::is_directory(package().user_support())) {
first_start = false;
string const configure_script =
- AddName(package().system_support(), "configure.py");
+ addName(package().system_support(), "configure.py");
string const userDefaults =
- AddName(package().user_support(), "lyxrc.defaults");
+ addName(package().user_support(), "lyxrc.defaults");
if (fs::exists(configure_script) &&
fs::exists(userDefaults) &&
fs::last_write_time(configure_script)
{
lyxerr[Debug::INIT] << "About to read " << name << "..." << endl;
- string const lyxrc_path = LibFileSearch(string(), name);
+ string const lyxrc_path = libFileSearch(string(), name);
if (!lyxrc_path.empty()) {
lyxerr[Debug::INIT] << "Found " << name
lyxerr[Debug::INIT] << "About to read " << name << "..." << endl;
- string const ui_path = LibFileSearch("ui", name, "ui");
+ string const ui_path = libFileSearch("ui", name, "ui");
if (ui_path.empty()) {
lyxerr[Debug::INIT] << "Could not find " << name << endl;
{
lyxerr[Debug::INIT] << "About to read " << name << "..." << endl;
- string const lang_path = LibFileSearch(string(), name);
+ string const lang_path = libFileSearch(string(), name);
if (lang_path.empty()) {
showFileError(name);
return;
{
lyxerr[Debug::INIT] << "About to read " << name << "..." << endl;
- string const enc_path = LibFileSearch(string(), name);
+ string const enc_path = libFileSearch(string(), name);
if (enc_path.empty()) {
showFileError(name);
return;
using bv_funcs::freefont2string;
-using lyx::support::AbsolutePath;
-using lyx::support::AddName;
-using lyx::support::AddPath;
+using lyx::support::absolutePath;
+using lyx::support::addName;
+using lyx::support::addPath;
using lyx::support::bformat;
-using lyx::support::ChangeExtension;
+using lyx::support::changeExtension;
using lyx::support::contains;
using lyx::support::FileFilterList;
-using lyx::support::FileSearch;
+using lyx::support::fileSearch;
using lyx::support::ForkedcallsController;
using lyx::support::i18nLibFileSearch;
using lyx::support::isDirWriteable;
using lyx::support::isFileReadable;
using lyx::support::isStrInt;
-using lyx::support::MakeAbsPath;
-using lyx::support::MakeDisplayPath;
+using lyx::support::makeAbsPath;
+using lyx::support::makeDisplayPath;
using lyx::support::package;
using lyx::support::Path;
-using lyx::support::QuoteName;
+using lyx::support::quoteName;
using lyx::support::rtrim;
using lyx::support::split;
using lyx::support::subst;
if (buf.isClean())
return true;
- string const file = MakeDisplayPath(buf.fileName(), 30);
+ string const file = makeDisplayPath(buf.fileName(), 30);
string text = bformat(_("The document %1$s has unsaved "
"changes.\n\nDo you want to save "
"the document?"), file);
{
string str = bformat(_("Could not print the document %1$s.\n"
"Check that your printer is set up correctly."),
- MakeDisplayPath(name, 50));
+ makeDisplayPath(name, 50));
Alert::error(_("Print document failed"), str);
}
case LFUN_MENUWRITE:
if (!owner->buffer()->isUnnamed()) {
string const str = bformat(_("Saving document %1$s..."),
- MakeDisplayPath(owner->buffer()->fileName()));
+ makeDisplayPath(owner->buffer()->fileName()));
owner->message(str);
MenuWrite(owner->buffer());
owner->message(str + _(" done."));
break;
case LFUN_MENURELOAD: {
- string const file = MakeDisplayPath(view()->buffer()->fileName(), 20);
+ string const file = makeDisplayPath(view()->buffer()->fileName(), 20);
string text = bformat(_("Any changes will be lost. Are you sure "
"you want to revert to the saved version of the document %1$s?"), file);
int const ret = Alert::prompt(_("Revert to saved document?"),
if (format->name() == "lyx") {
string const latexname =
buffer->getLatexName(false);
- filename = ChangeExtension(latexname,
+ filename = changeExtension(latexname,
format->extension());
- filename = AddName(buffer->temppath(), filename);
+ filename = addName(buffer->temppath(), filename);
if (!buffer->writeFile(filename))
break;
Systemcall one;
int res = 0;
string const dviname =
- ChangeExtension(buffer->getLatexName(true),
+ changeExtension(buffer->getLatexName(true),
"dvi");
if (target == "printer") {
if (!lyxrc.print_spool_command.empty()) {
// case 3: print using a spool
string const psname =
- ChangeExtension(dviname,".ps");
+ changeExtension(dviname,".ps");
command += lyxrc.print_to_file
- + QuoteName(psname)
+ + quoteName(psname)
+ ' '
- + QuoteName(dviname);
+ + quoteName(dviname);
string command2 =
lyxrc.print_spool_command +' ';
+ target_name
+ ' ';
}
- command2 += QuoteName(psname);
+ command2 += quoteName(psname);
// First run dvips.
// If successful, then spool command
res = one.startscript(
// case 2: print directly to a printer
res = one.startscript(
Systemcall::DontWait,
- command + QuoteName(dviname));
+ command + quoteName(dviname));
}
} else {
// case 1: print to a file
command += lyxrc.print_to_file
- + QuoteName(MakeAbsPath(target_name,
+ + quoteName(makeAbsPath(target_name,
path))
+ ' '
- + QuoteName(dviname);
+ + quoteName(dviname);
res = one.startscript(Systemcall::DontWait,
command);
}
break;
}
owner->message(bformat(_("Opening help file %1$s..."),
- MakeDisplayPath(fname)));
+ makeDisplayPath(fname)));
view()->loadLyXFile(fname, false);
break;
}
} else {
// Must replace extension of the file to be .lyx
// and get full path
- string const s = ChangeExtension(file_name, ".lyx");
+ string const s = changeExtension(file_name, ".lyx");
// Either change buffer or load the file
if (bufferlist.exists(s)) {
view()->setBuffer(bufferlist.getBuffer(s));
case LFUN_CHILDOPEN: {
string const filename =
- MakeAbsPath(argument, owner->buffer()->filePath());
+ makeAbsPath(argument, owner->buffer()->filePath());
setMessage(N_("Opening child document ") +
- MakeDisplayPath(filename) + "...");
+ makeDisplayPath(filename) + "...");
view()->savePosition(0);
string const parentfilename = owner->buffer()->fileName();
if (bufferlist.exists(filename))
case LFUN_SAVE_AS_DEFAULT: {
string const fname =
- AddName(AddPath(package().user_support(), "templates/"),
+ addName(addPath(package().user_support(), "templates/"),
"defaults.lyx");
Buffer defaults(fname);
if (defaults.writeFile(defaults.fileName()))
setMessage(_("Document defaults saved in ")
- + MakeDisplayPath(fname));
+ + makeDisplayPath(fname));
else
setErrorMessage(_("Unable to save document defaults"));
break;
static int newfile_number;
if (filename.empty()) {
- filename = AddName(lyxrc.document_path,
+ filename = addName(lyxrc.document_path,
"newfile" + convert<string>(++newfile_number) + ".lyx");
while (bufferlist.exists(filename) || fs::is_readable(filename)) {
++newfile_number;
- filename = AddName(lyxrc.document_path,
+ filename = addName(lyxrc.document_path,
"newfile" + convert<string>(newfile_number) +
".lyx");
}
make_pair(string(_("Documents|#o#O")),
string(lyxrc.document_path)),
make_pair(string(_("Examples|#E#e")),
- string(AddPath(package().system_support(), "examples"))));
+ string(addPath(package().system_support(), "examples"))));
FileDialog::Result result =
fileDlg.open(initpath,
// get absolute path of file and add ".lyx" to the filename if
// necessary
- string const fullpath = FileSearch(string(), filename, "lyx");
+ string const fullpath = fileSearch(string(), filename, "lyx");
if (!fullpath.empty()) {
filename = fullpath;
}
- string const disp_fn(MakeDisplayPath(filename));
+ string const disp_fn(makeDisplayPath(filename));
// if the file doesn't exist, let the user create one
if (!fs::exists(filename)) {
make_pair(string(_("Documents|#o#O")),
string(lyxrc.document_path)),
make_pair(string(_("Examples|#E#e")),
- string(AddPath(package().system_support(), "examples"))));
+ string(addPath(package().system_support(), "examples"))));
string const filter = formats.prettyName(format)
+ " (*." + formats.extension(format) + ')';
return;
// get absolute path of file
- filename = MakeAbsPath(filename);
+ filename = makeAbsPath(filename);
- string const lyxfile = ChangeExtension(filename, ".lyx");
+ string const lyxfile = changeExtension(filename, ".lyx");
// Check if the document already is open
if (lyx_gui::use_gui && bufferlist.exists(lyxfile)) {
// if the file exists already, and we didn't do
// -i lyx thefile.lyx, warn
if (fs::exists(lyxfile) && filename != lyxfile) {
- string const file = MakeDisplayPath(lyxfile, 30);
+ string const file = makeDisplayPath(lyxfile, 30);
string text = bformat(_("The document %1$s already exists.\n\n"
"Do you want to over-write that document?"), file);
using lyx::support::compare_ascii_no_case;
using lyx::support::getFormatFromContents;
-using lyx::support::MakeDisplayPath;
+using lyx::support::makeDisplayPath;
using lyx::support::split;
using lyx::support::subst;
{
string const tmpmsg = subst(message, "$$Token", getString());
lyxerr << "LyX: " << tmpmsg << " [around line " << lineno
- << " of file " << MakeDisplayPath(name) << ']' << endl;
+ << " of file " << makeDisplayPath(name) << ']' << endl;
}
using lyx::support::ascii_lowercase;
using lyx::support::bformat;
-using lyx::support::ExpandPath;
+using lyx::support::expandPath;
using lyx::support::getEnv;
-using lyx::support::LibFileSearch;
+using lyx::support::libFileSearch;
using lyx::support::token;
using std::cout;
case RC_INPUT: // Include file
if (lexrc.next()) {
string const tmp =
- LibFileSearch(string(),
+ libFileSearch(string(),
lexrc.getString());
if (read(tmp)) {
lexrc.printError("Error reading "
string const kmap(os::internal_path(lexrc.getString()));
if (kmap.empty()) {
// nothing
- } else if (!LibFileSearch("kbd", kmap,
+ } else if (!libFileSearch("kbd", kmap,
"kmap").empty()) {
primary_kbmap = kmap;
} else {
string const kmap(os::internal_path(lexrc.getString()));
if (kmap.empty()) {
// nothing
- } else if (!LibFileSearch("kbd", kmap,
+ } else if (!libFileSearch("kbd", kmap,
"kmap").empty()) {
secondary_kbmap = kmap;
} else {
case RC_DOCUMENTPATH:
if (lexrc.next()) {
document_path = os::internal_path(lexrc.getString());
- document_path = ExpandPath(document_path);
+ document_path = expandPath(document_path);
}
break;
case RC_TEMPLATEPATH:
if (lexrc.next()) {
template_path = os::internal_path(lexrc.getString());
- template_path = ExpandPath(template_path);
+ template_path = expandPath(template_path);
}
break;
case RC_TEMPDIRPATH:
if (lexrc.next()) {
tempdir_path = os::internal_path(lexrc.getString());
- tempdir_path = ExpandPath(tempdir_path);
+ tempdir_path = expandPath(tempdir_path);
}
break;
case RC_SERVERPIPE:
if (lexrc.next()) {
lyxpipes = os::internal_path(lexrc.getString());
- lyxpipes = ExpandPath(lyxpipes);
+ lyxpipes = expandPath(lyxpipes);
}
break;
case RC_BACKUPDIR_PATH:
if (lexrc.next()) {
backupdir_path = os::internal_path(lexrc.getString());
- backupdir_path = ExpandPath(backupdir_path);
+ backupdir_path = expandPath(backupdir_path);
}
break;
case RC_DATE_INSERT_FORMAT:
#include <sstream>
-using lyx::support::LibFileSearch;
-using lyx::support::MakeDisplayPath;
-using lyx::support::QuoteName;
+using lyx::support::libFileSearch;
+using lyx::support::makeDisplayPath;
+using lyx::support::quoteName;
using lyx::support::rtrim;
using lyx::support::subst;
bool layout2layout(string const & filename, string const & tempfile)
{
- string const script = LibFileSearch("scripts", "layout2layout.py");
+ string const script = libFileSearch("scripts", "layout2layout.py");
if (script.empty()) {
lyxerr << "Could not find layout conversion "
"script layout2layout.py." << endl;
}
std::ostringstream command;
- command << "python " << QuoteName(script)
- << ' ' << QuoteName(filename)
- << ' ' << QuoteName(tempfile);
+ command << "python " << quoteName(script)
+ << ' ' << quoteName(filename)
+ << ' ' << quoteName(tempfile);
string const command_str = command.str();
lyxerr[Debug::TCLASS] << "Running `" << command_str << '\'' << endl;
lyx::support::cmd_ret const ret =
- lyx::support::RunCommand(command_str);
+ lyx::support::runCommand(command_str);
if (ret.first != 0) {
lyxerr << "Could not run layout conversion "
"script layout2layout.py." << endl;
if (!merge)
lyxerr[Debug::TCLASS] << "Reading textclass "
- << MakeDisplayPath(filename)
+ << makeDisplayPath(filename)
<< endl;
else
lyxerr[Debug::TCLASS] << "Reading input file "
- << MakeDisplayPath(filename)
+ << makeDisplayPath(filename)
<< endl;
LyXLex lexrc(textClassTags,
case TC_INPUT: // Include file
if (lexrc.next()) {
- string tmp = LibFileSearch("layouts",
+ string tmp = libFileSearch("layouts",
lexrc.getString(),
"layout");
if (!merge) { // we are at top level here.
lyxerr[Debug::TCLASS] << "Finished reading textclass "
- << MakeDisplayPath(filename)
+ << makeDisplayPath(filename)
<< endl;
if (defaultlayout_.empty()) {
lyxerr << "Error: Textclass '" << name_
} else
lyxerr[Debug::TCLASS] << "Finished reading input file "
- << MakeDisplayPath(filename)
+ << makeDisplayPath(filename)
<< endl;
return error;
return true;
// Read style-file
- string const real_file = LibFileSearch("layouts", name_, "layout");
+ string const real_file = libFileSearch("layouts", name_, "layout");
loaded_ = const_cast<LyXTextClass*>(this)->Read(real_file) == 0;
if (!loaded_) {
lyxerr << "Error reading `"
- << MakeDisplayPath(real_file)
+ << makeDisplayPath(real_file)
<< "'\n(Check `" << name_
<< "')\nCheck your installation and "
"try Options/Reconfigure..." << endl;
using lyx::textclass_type;
-using lyx::support::LibFileSearch;
-using lyx::support::MakeDisplayPath;
+using lyx::support::libFileSearch;
+using lyx::support::makeDisplayPath;
using boost::bind;
bool LyXTextClassList::Read()
{
LyXLex lex(0, 0);
- string real_file = LibFileSearch("", "textclass.lst");
+ string real_file = libFileSearch("", "textclass.lst");
lyxerr[Debug::TCLASS] << "Reading textclasses from `"
<< real_file << '\'' << endl;
if (real_file.empty()) {
lyxerr << "LyXTextClassList::Read: unable to find "
- "textclass file `" << MakeDisplayPath(real_file, 1000)
+ "textclass file `" << makeDisplayPath(real_file, 1000)
<< "'. Exiting." << endl;
return false;
// This causes LyX to end... Not a desirable behaviour. Lgb
if (!lex.isOK()) {
lyxerr << "LyXTextClassList::Read: unable to open "
- "textclass file `" << MakeDisplayPath(real_file, 1000)
+ "textclass file `" << makeDisplayPath(real_file, 1000)
<< "'\nCheck your installation. LyX can't continue."
<< endl;
return false;
using lyx::support::bformat;
using lyx::support::isFileReadable;
-using lyx::support::MakeDisplayPath;
+using lyx::support::makeDisplayPath;
using lyx::support::tempName;
using std::endl;
if (isFileReadable(cvs_entries)) {
lyxerr[Debug::LYXVC]
<< "LyXVC: registering "
- << MakeDisplayPath(filename)
+ << makeDisplayPath(filename)
<< " with CVS" << endl;
vcs.reset(new CVS(cvs_entries, filename));
} else {
lyxerr[Debug::LYXVC]
<< "LyXVC: registering "
- << MakeDisplayPath(filename)
+ << makeDisplayPath(filename)
<< " with RCS" << endl;
vcs.reset(new RCS(filename));
}
{
lyxerr[Debug::LYXVC] << "LyXVC: revert" << endl;
- string const file = MakeDisplayPath(owner_->fileName(), 20);
+ string const file = makeDisplayPath(owner_->fileName(), 20);
string text = bformat(_("Reverting to the stored version of the "
"document %1$s will lose all current changes.\n\n"
"Do you want to revert to the saved version?"), file);
#include <fstream>
#include <sstream>
-using lyx::support::LibFileSearch;
+using lyx::support::libFileSearch;
using std::string;
using std::ifstream;
void initAutoCorrect()
{
lyxerr[Debug::MATHED] << "reading autocorrect file" << endl;
- string const file = LibFileSearch(string(), "autocorrect");
+ string const file = libFileSearch(string(), "autocorrect");
if (file.empty()) {
lyxerr << "Could not find autocorrect file" << endl;
return;
using lyx::support::cmd_ret;
using lyx::support::getVectorFromString;
-using lyx::support::LibFileSearch;
-using lyx::support::RunCommand;
+using lyx::support::libFileSearch;
+using lyx::support::runCommand;
using lyx::support::subst;
using std::string;
{
string command = "echo '" + data + "' | " + cmd;
lyxerr << "calling: " << command << endl;
- cmd_ret const ret = RunCommand(command);
+ cmd_ret const ret = runCommand(command);
return ret.second;
}
string data = os.str();
// search external script
- string file = LibFileSearch("mathed", "extern_" + lang);
+ string file = libFileSearch("mathed", "extern_" + lang);
if (file.empty()) {
lyxerr << "converter to '" << lang << "' not found" << endl;
return MathArray();
#include <fstream>
#include <sstream>
-using lyx::support::LibFileSearch;
+using lyx::support::libFileSearch;
using lyx::support::split;
using std::string;
void initSymbols()
{
- string const filename = LibFileSearch(string(), "symbols");
+ string const filename = libFileSearch(string(), "symbols");
lyxerr[Debug::MATHED] << "read symbols from " << filename << endl;
if (filename.empty()) {
lyxerr << "Could not find symbols file" << endl;
if (command_.empty())
return Mover::do_copy(from, to, latex);
- string command = support::LibScriptSearch(command_);
+ string command = support::libScriptSearch(command_);
command = support::subst(command, "$$i", from);
command = support::subst(command, "$$o", to);
command = support::subst(command, "$$l", latex);
#include <fstream>
using lyx::support::bformat;
-using lyx::support::MakeDisplayPath;
+using lyx::support::makeDisplayPath;
using std::ofstream;
using std::string;
{
ofs.open(fname.c_str());
if (!ofs) {
- string const file = MakeDisplayPath(fname, 50);
+ string const file = makeDisplayPath(fname, 50);
string text = bformat(_("Could not open the specified "
"document\n%1$s."), file);
Alert::error(_("Could not open file"), text);
#include <algorithm>
#include <iterator>
-using lyx::support::AddName;
+using lyx::support::addName;
using lyx::support::package;
namespace fs = boost::filesystem;
setNumberOfLastFiles(num);
// locate the session file
// note that the session file name 'session' is hard-coded
- session_file = AddName(package().user_support(), "session");
+ session_file = addName(package().user_support(), "session");
//
readFile();
}
FileName::FileName(string const & abs_filename, bool save_abs)
: name_(abs_filename), save_abs_path_(save_abs)
{
- BOOST_ASSERT(AbsolutePath(name_));
+ BOOST_ASSERT(absolutePath(name_));
}
void FileName::set(string const & name, string const & buffer_path)
{
- save_abs_path_ = AbsolutePath(name);
- name_ = save_abs_path_ ? name : MakeAbsPath(name, buffer_path);
+ save_abs_path_ = absolutePath(name);
+ name_ = save_abs_path_ ? name : makeAbsPath(name, buffer_path);
}
string const FileName::relFilename(string const & path) const
{
- return MakeRelPath(name_, path);
+ return makeRelPath(name_, path);
}
string const FileName::outputFilename(string const & path) const
{
- return save_abs_path_ ? name_ : MakeRelPath(name_, path);
+ return save_abs_path_ ? name_ : makeRelPath(name_, path);
}
// Now the real work
string mname = os::internal_path(name_);
// Remove the extension.
- mname = ChangeExtension(name_, string());
+ mname = changeExtension(name_, string());
// Replace '/' in the file name with '_'
mname = subst(mname, "/", "_");
// Replace '.' in the file name with '_'
// Replace ':' in the file name with '_'
mname = subst(mname, ":", "_");
// Add the extension back on
- mname = ChangeExtension(mname, GetExtension(name_));
+ mname = changeExtension(mname, getExtension(name_));
// Prepend a counter to the filename. This is necessary to make
// the mangled name unique.
if (extension == EXCLUDE_EXTENSION) {
// ChangeExtension calls os::internal_path internally
// so don't use it to remove the extension.
- string const ext = GetExtension(path);
+ string const ext = getExtension(path);
string const base = ext.empty() ?
path :
path.substr(0, path.length() - ext.length() - 1);
// Substitutes spaces with underscores in filename (and path)
-string const MakeLatexName(string const & file)
+string const makeLatexName(string const & file)
{
- string name = OnlyFilename(file);
- string const path = OnlyPath(file);
+ string name = onlyFilename(file);
+ string const path = onlyPath(file);
for (string::size_type i = 0; i < name.length(); ++i)
name[i] &= 0x7f; // set 8th bit to 0
while ((pos = name.find_first_not_of(keep, pos)) != string::npos)
name[pos++] = '_';
- return AddName(path, name);
+ return addName(path, name);
}
-string const QuoteName(string const & name)
+string const quoteName(string const & name)
{
return (os::shell() == os::UNIX) ?
'\'' + name + '\'':
// If path entry begins with $$LyX/, use system_lyxdir
// If path entry begins with $$User/, use user_lyxdir
// Example: "$$User/doc;$$LyX/doc"
-string const FileOpenSearch(string const & path, string const & name,
+string const fileOpenSearch(string const & path, string const & name,
string const & ext)
{
string real_file;
path_element = subst(path_element, "$$User",
package().user_support());
- real_file = FileSearch(path_element, name, ext);
+ real_file = fileSearch(path_element, name, ext);
if (real_file.empty()) {
do {
}
#ifdef __EMX__
if (ext.empty() && notfound) {
- real_file = FileOpenSearch(path, name, "exe");
- if (notfound) real_file = FileOpenSearch(path, name, "cmd");
+ real_file = fileOpenSearch(path, name, "exe");
+ if (notfound)
+ real_file = fileOpenSearch(path, name, "cmd");
}
#endif
return real_file;
/// Returns a vector of all files in directory dir having extension ext.
-vector<string> const DirList(string const & dir, string const & ext)
+vector<string> const dirList(string const & dir, string const & ext)
{
// EXCEPTIONS FIXME. Rewrite needed when we turn on exceptions. (Lgb)
vector<string> dirlist;
// Returns the real name of file name in directory path, with optional
// extension ext.
-string const FileSearch(string const & path, string const & name,
+string const fileSearch(string const & path, string const & name,
string const & ext)
{
// if `name' is an absolute path, we ignore the setting of `path'
// Expand Environmentvariables in 'name'
- string const tmpname = ReplaceEnvironmentPath(name);
- string fullname = MakeAbsPath(tmpname, path);
+ string const tmpname = replaceEnvironmentPath(name);
+ string fullname = makeAbsPath(tmpname, path);
// search first without extension, then with it.
if (isFileReadable(fullname))
return fullname;
// 1) user_lyxdir
// 2) build_lyxdir (if not empty)
// 3) system_lyxdir
-string const LibFileSearch(string const & dir, string const & name,
+string const libFileSearch(string const & dir, string const & name,
string const & ext)
{
- string fullname = FileSearch(AddPath(package().user_support(), dir),
+ string fullname = fileSearch(addPath(package().user_support(), dir),
name, ext);
if (!fullname.empty())
return fullname;
if (!package().build_support().empty())
- fullname = FileSearch(AddPath(package().build_support(), dir),
+ fullname = fileSearch(addPath(package().build_support(), dir),
name, ext);
if (!fullname.empty())
return fullname;
- return FileSearch(AddPath(package().system_support(), dir), name, ext);
+ return fileSearch(addPath(package().system_support(), dir), name, ext);
}
string l;
lang = split(lang, l, ':');
while (!l.empty() && l != "C" && l != "POSIX") {
- string const tmp = LibFileSearch(dir,
+ string const tmp = libFileSearch(dir,
token(l, '_', 0) + '_' + name,
ext);
if (!tmp.empty())
lang = split(lang, l, ':');
}
- return LibFileSearch(dir, name, ext);
+ return libFileSearch(dir, name, ext);
}
-string const LibScriptSearch(string const & command_in)
+string const libScriptSearch(string const & command_in)
{
static string const token_scriptpath = "$$s/";
// Does this script file exist?
string const script =
- LibFileSearch(".", command.substr(start_script, size_script));
+ libFileSearch(".", command.substr(start_script, size_script));
if (script.empty()) {
// Replace "$$s/" with ""
} else {
// Replace "$$s/foo/some_script" with "<path to>/some_script".
string::size_type const size_replace = size_script + 4;
- command.replace(pos1, size_replace, QuoteName(script));
+ command.replace(pos1, size_replace, quoteName(script));
}
return command;
return string();
}
- return MakeAbsPath(tmpfl);
+ return makeAbsPath(tmpfl);
}
} // namespace anon
// Strip filename from path name
-string const OnlyPath(string const & filename)
+string const onlyPath(string const & filename)
{
// If empty filename, return empty
if (filename.empty())
// Convert relative path into absolute path based on a basepath.
// If relpath is absolute, just use that.
// If basepath is empty, use CWD as base.
-string const MakeAbsPath(string const & RelPath, string const & BasePath)
+string const makeAbsPath(string const & relPath, string const & basePath)
{
// checks for already absolute path
- if (os::is_absolute_path(RelPath))
- return RelPath;
+ if (os::is_absolute_path(relPath))
+ return relPath;
// Copies given paths
- string TempRel = os::internal_path(RelPath);
+ string tempRel = os::internal_path(relPath);
// Since TempRel is NOT absolute, we can safely replace "//" with "/"
- TempRel = subst(TempRel, "//", "/");
+ tempRel = subst(tempRel, "//", "/");
- string TempBase;
+ string tempBase;
- if (os::is_absolute_path(BasePath))
- TempBase = BasePath;
+ if (os::is_absolute_path(basePath))
+ tempBase = basePath;
else
- TempBase = AddPath(getcwd(), BasePath);
+ tempBase = addPath(getcwd(), basePath);
// Handle /./ at the end of the path
- while (suffixIs(TempBase, "/./"))
- TempBase.erase(TempBase.length() - 2);
+ while (suffixIs(tempBase, "/./"))
+ tempBase.erase(tempBase.length() - 2);
// processes relative path
- string RTemp = TempRel;
- string Temp;
+ string rTemp = tempRel;
+ string temp;
- while (!RTemp.empty()) {
+ while (!rTemp.empty()) {
// Split by next /
- RTemp = split(RTemp, Temp, '/');
+ rTemp = split(rTemp, temp, '/');
- if (Temp == ".") continue;
- if (Temp == "..") {
+ if (temp == ".") continue;
+ if (temp == "..") {
// Remove one level of TempBase
- string::difference_type i = TempBase.length() - 2;
+ string::difference_type i = tempBase.length() - 2;
#ifndef __EMX__
if (i < 0)
i = 0;
- while (i > 0 && TempBase[i] != '/')
+ while (i > 0 && tempBase[i] != '/')
--i;
if (i > 0)
#else
if (i < 2)
i = 2;
- while (i > 2 && TempBase[i] != '/')
+ while (i > 2 && tempBase[i] != '/')
--i;
if (i > 2)
#endif
- TempBase.erase(i, string::npos);
+ tempBase.erase(i, string::npos);
else
- TempBase += '/';
- } else if (Temp.empty() && !RTemp.empty()) {
- TempBase = os::current_root() + RTemp;
- RTemp.erase();
+ tempBase += '/';
+ } else if (temp.empty() && !rTemp.empty()) {
+ tempBase = os::current_root() + rTemp;
+ rTemp.erase();
} else {
// Add this piece to TempBase
- if (!suffixIs(TempBase, '/'))
- TempBase += '/';
- TempBase += Temp;
+ if (!suffixIs(tempBase, '/'))
+ tempBase += '/';
+ tempBase += temp;
}
}
// returns absolute path
- return os::internal_path(TempBase);
+ return os::internal_path(tempBase);
}
// Correctly append filename to the pathname.
// If pathname is '.', then don't use pathname.
// Chops any path of filename.
-string const AddName(string const & path, string const & fname)
+string const addName(string const & path, string const & fname)
{
- string const basename = OnlyFilename(fname);
+ string const basename = onlyFilename(fname);
string buf;
if (path != "." && path != "./" && !path.empty()) {
// Strips path from filename
-string const OnlyFilename(string const & fname)
+string const onlyFilename(string const & fname)
{
if (fname.empty())
return fname;
/// Returns true is path is absolute
-bool AbsolutePath(string const & path)
+bool absolutePath(string const & path)
{
return os::is_absolute_path(path);
}
// 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)
+string const expandPath(string const & path)
{
// checks for already absolute path
- string RTemp = ReplaceEnvironmentPath(path);
- if (os::is_absolute_path(RTemp))
- return RTemp;
+ string rTemp = replaceEnvironmentPath(path);
+ if (os::is_absolute_path(rTemp))
+ return rTemp;
- string Temp;
- string const copy = RTemp;
+ string temp;
+ string const copy = rTemp;
// Split by next /
- RTemp = split(RTemp, Temp, '/');
+ rTemp = split(rTemp, temp, '/');
- if (Temp == ".")
- return getcwd() + '/' + RTemp;
+ if (temp == ".")
+ return getcwd() + '/' + rTemp;
- if (Temp == "~")
- return package().home_dir() + '/' + RTemp;
+ if (temp == "~")
+ return package().home_dir() + '/' + rTemp;
- if (Temp == "..")
- return MakeAbsPath(copy);
+ if (temp == "..")
+ return makeAbsPath(copy);
// Don't know how to handle this
return copy;
// Normalize a path. Constracts path/../path
// Can't handle "../../" or "/../" (Asger)
// Also converts paths like /foo//bar ==> /foo/bar
-string const NormalizePath(string const & path)
+string const normalizePath(string const & path)
{
// Normalize paths like /foo//bar ==> /foo/bar
static boost::regex regex("/{2,}");
}
-string const GetFileContents(string const & fname)
+string const getFileContents(string const & fname)
{
if (fs::exists(fname)) {
ifstream ifs(fname.c_str());
// Search the string for ${VAR} and $VAR and replace VAR using getenv.
-string const ReplaceEnvironmentPath(string const & path)
+string const replaceEnvironmentPath(string const & path)
{
// ${VAR} is defined as
// $\{[A-Za-z_][A-Za-z_0-9]*\}
// Make relative path out of two absolute paths
-string const MakeRelPath(string const & abspath, string const & basepath)
+string const makeRelPath(string const & abspath, string const & basepath)
// Makes relative path out of absolute path. If it is deeper than basepath,
// it's easy. If basepath and abspath share something (they are all deeper
// than some directory), it'll be rendered using ..'s. If they are completely
// Append sub-directory(ies) to a path in an intelligent way
-string const AddPath(string const & path, string const & path_2)
+string const addPath(string const & path, string const & path_2)
{
string buf;
string const path2 = os::internal_path(path_2);
Strips path off if no_path == true.
If no extension on oldname, just appends.
*/
-string const ChangeExtension(string const & oldname, string const & extension)
+string const changeExtension(string const & oldname, string const & extension)
{
string::size_type const last_slash = oldname.rfind('/');
string::size_type last_dot = oldname.rfind('.');
string const removeExtension(string const & name)
{
- return ChangeExtension(name, string());
+ return changeExtension(name, string());
}
/// Return the extension of the file (not including the .)
-string const GetExtension(string const & name)
+string const getExtension(string const & name)
{
string::size_type const last_slash = name.rfind('/');
string::size_type const last_dot = name.rfind('.');
string const unzippedFileName(string const & zipped_file)
{
- string const ext = GetExtension(zipped_file);
+ string const ext = getExtension(zipped_file);
if (ext == "gz" || ext == "z" || ext == "Z")
- return ChangeExtension(zipped_file, string());
+ return changeExtension(zipped_file, string());
return "unzipped_" + zipped_file;
}
}
-string const MakeDisplayPath(string const & path, unsigned int threshold)
+string const makeDisplayPath(string const & path, unsigned int threshold)
{
string str = path;
string const home = package().home_dir();
if (str.empty()) {
// Yes, filename itself is too long.
// Pick the start and the end of the filename.
- str = OnlyFilename(path);
+ str = onlyFilename(path);
string const head = str.substr(0, threshold / 2 - 3);
string::size_type len = str.length();
}
-bool LyXReadLink(string const & file, string & link, bool resolve)
+bool readLink(string const & file, string & link, bool resolve)
{
#ifdef HAVE_READLINK
char linkbuffer[512];
return false;
linkbuffer[nRead] = '\0'; // terminator
if (resolve)
- link = MakeAbsPath(linkbuffer, OnlyPath(file));
+ link = makeAbsPath(linkbuffer, onlyPath(file));
else
link = linkbuffer;
return true;
}
-cmd_ret const RunCommand(string const & cmd)
+cmd_ret const runCommand(string const & cmd)
{
// FIXME: replace all calls to RunCommand with ForkedCall
// (if the output is not needed) or the code in ispell.C
// If the file can be found directly, we just return a
// absolute path version of it.
if (fs::exists(fil))
- return MakeAbsPath(fil);
+ return makeAbsPath(fil);
// No we try to find it using kpsewhich.
// It seems from the kpsewhich manual page that it is safe to use
// should help it by setting additional path in the approp. envir.var.
string const kpsecmd = "kpsewhich " + fil;
- cmd_ret const c = RunCommand(kpsecmd);
+ cmd_ret const c = runCommand(kpsecmd);
lyxerr[Debug::LATEX] << "kpse status = " << c.first << '\n'
<< "kpse result = `" << rtrim(c.second, "\n")
void removeAutosaveFile(string const & filename)
{
- string a = OnlyPath(filename);
+ string a = onlyPath(filename);
a += '#';
- a += OnlyFilename(filename);
+ a += onlyFilename(filename);
a += '#';
if (fs::exists(a))
unlink(a);
int compare_timestamps(string const & file1, string const & file2)
{
- BOOST_ASSERT(AbsolutePath(file1));
- BOOST_ASSERT(AbsolutePath(file2));
+ BOOST_ASSERT(absolutePath(file1));
+ BOOST_ASSERT(absolutePath(file2));
// If the original is newer than the copy, then copy the original
// to the new directory.
If path entry begins with $$User/, use user_lyxdir.
Example: "$$User/doc;$$LyX/doc".
*/
-std::string const FileOpenSearch(std::string const & path, std::string const & name,
- std::string const & ext = std::string());
+std::string const fileOpenSearch(std::string const & path,
+ std::string const & name,
+ std::string const & ext = std::string());
/** Returns the real name of file name in directory path, with optional
extension ext.
The file is searched in the given path (unless it is an absolute
file name), first directly, and then with extension .ext (if given).
*/
-std::string const FileSearch(std::string const & path, std::string const & name,
- std::string const & ext = std::string());
+std::string const fileSearch(std::string const & path,
+ std::string const & name,
+ std::string const & ext = std::string());
/// Returns a vector of all files in directory dir having extension ext.
-std::vector<std::string> const DirList(std::string const & dir,
- std::string const & ext = std::string());
+std::vector<std::string> const dirList(std::string const & dir,
+ std::string const & ext = std::string());
/** Is directory read only?
returns
true: dir writeable
false: not writeable
*/
-bool isDirWriteable (std::string const & path);
+bool isDirWriteable(std::string const & path);
/** Is a file readable ?
Returns true if the file `path' is readable.
-# system_lyxdir
The third parameter `ext' is optional.
*/
-std::string const LibFileSearch(std::string const & dir, std::string const & name,
- std::string const & ext = std::string());
+std::string const libFileSearch(std::string const & dir,
+ std::string const & name,
+ std::string const & ext = std::string());
-/** Same as LibFileSearch(), but tries first to find an
+/** Same as libFileSearch(), but tries first to find an
internationalized version of the file by prepending $LANG_ to the
name
*/
std::string const
-i18nLibFileSearch(std::string const & dir, std::string const & name,
+i18nLibFileSearch(std::string const & dir,
+ std::string const & name,
std::string const & ext = std::string());
/** Takes a command such as "sh $$s/scripts/convertDefault.sh file.in file.out"
* command will still fail, but the error message will make some sort of
* sense ;-)
*/
-std::string const LibScriptSearch(std::string const & command);
+std::string const libScriptSearch(std::string const & command);
enum latex_path_extension {
PROTECT_EXTENSION,
latex_path_dots dots = LEAVE_DOTS);
/// Substitutes active latex characters with underscores in filename
-std::string const MakeLatexName(std::string const & file);
+std::string const makeLatexName(std::string const & file);
/// Put the name in quotes suitable for the current shell
-std::string const QuoteName(std::string const & file);
+std::string const quoteName(std::string const & file);
/// Add a filename to a path. Any path from filename is stripped first.
-std::string const AddName(std::string const & path, std::string const & fname);
+std::string const addName(std::string const & path, std::string const & fname);
/// Append sub-directory(ies) to path in an intelligent way
-std::string const AddPath(std::string const & path, std::string const & path2);
+std::string const addPath(std::string const & path, std::string const & path2);
/** Change extension of oldname to extension.
If oldname does not have an extension, it is appended.
If the extension is empty, any extension is removed from the name.
*/
std::string const
-ChangeExtension(std::string const & oldname, std::string const & extension);
+changeExtension(std::string const & oldname, std::string const & extension);
/// Remove the extension from \p name
std::string const removeExtension(std::string const & name);
/// Return the extension of the file (not including the .)
-std::string const GetExtension(std::string const & name);
+std::string const getExtension(std::string const & name);
/** Guess the file format name (as in Format::name()) from contents.
Normally you don't want to use this directly, but rather
std::string const & unzipped_file = std::string());
/// Returns true is path is absolute
-bool AbsolutePath(std::string const & path);
+bool absolutePath(std::string const & path);
/// Create absolute path. If impossible, don't do anything
-std::string const ExpandPath(std::string const & path);
+std::string const expandPath(std::string const & path);
/** Convert relative path into absolute path based on a basepath.
If relpath is absolute, just use that.
If basepath doesn't exist use CWD.
*/
-std::string const MakeAbsPath(std::string const & RelPath = std::string(),
- std::string const & BasePath = std::string());
+std::string const makeAbsPath(std::string const & RelPath = std::string(),
+ std::string const & BasePath = std::string());
/** Creates a nice compact path for displaying. The parameter
threshold, if given, specifies the maximal length of the path.
*/
std::string const
-MakeDisplayPath(std::string const & path, unsigned int threshold = 1000);
+makeDisplayPath(std::string const & path, unsigned int threshold = 1000);
/** Makes relative path out of absolute path.
If it is deeper than basepath,
WARNING: the absolute path and base path must really be absolute paths!!!
*/
std::string const
-MakeRelPath(std::string const & abspath, std::string const & basepath);
+makeRelPath(std::string const & abspath, std::string const & basepath);
/// Strip filename from path name
-std::string const OnlyPath(std::string const & fname);
+std::string const onlyPath(std::string const & fname);
/** Normalize a path. Constracts path/../path
* Also converts paths like /foo//bar ==> /foo/bar
*/
-std::string const NormalizePath(std::string const & path);
+std::string const normalizePath(std::string const & path);
/// Strips path from filename
-std::string const OnlyFilename(std::string const & fname);
+std::string const onlyFilename(std::string const & fname);
/// Get the contents of a file as a huge std::string
-std::string const GetFileContents(std::string const & fname);
+std::string const getFileContents(std::string const & fname);
/** Check and Replace Environmentvariables ${NAME} in Path.
Replaces all occurences of these, if they are found in the
environment.
Variables are defined by Var := '${' [a-zA-Z_][a-zA-Z_0-9]* '}'
*/
-std::string const ReplaceEnvironmentPath(std::string const & path);
+std::string const replaceEnvironmentPath(std::string const & path);
/* Set \c link to the path \c file points to as a symbolic link.
If \c resolve is true, then \c link is an absolute path
Returns true if successful */
-bool LyXReadLink(std::string const & file, std::string & link, bool resolve = false);
+bool readLink(std::string const & file,
+ std::string & link,
+ bool resolve = false);
/// Uses kpsewhich to find tex files
-std::string const findtexfile(std::string const & fil, std::string const & format);
+std::string const findtexfile(std::string const & fil,
+ std::string const & format);
/// remove the autosave-file and give a Message if it can't be done
void removeAutosaveFile(std::string const & filename);
typedef std::pair<int, std::string> cmd_ret;
-cmd_ret const RunCommand(std::string const & cmd);
+cmd_ret const runCommand(std::string const & cmd);
} // namespace support
} // namespace lyx
document_dir_ = get_document_dir(home_dir_);
string const abs_binary = abs_path_from_binary_name(command_line_arg0);
- binary_dir_ = OnlyPath(abs_binary);
+ binary_dir_ = onlyPath(abs_binary);
// Is LyX being run in-place from the build tree?
boost::tie(build_support_dir_, system_support_dir_) =
break;
}
- return NormalizePath(AddPath(binary_dir, indirection));
+ return normalizePath(addPath(binary_dir, indirection));
}
string binary = abs_binary;
while (true) {
// Try and find "lyxrc.defaults".
- string const binary_dir = OnlyPath(binary);
+ string const binary_dir = onlyPath(binary);
string const build_support_dir =
get_build_support_dir(binary_dir, top_build_dir_location);
- if (!FileSearch(build_support_dir, "lyxrc.defaults").empty()) {
+ if (!fileSearch(build_support_dir, "lyxrc.defaults").empty()) {
// Try and find "chkconfig.ltx".
string const system_support_dir =
- MakeAbsPath(AddPath(top_srcdir(), "lib"),
- AddPath(binary_dir, "support"));
+ makeAbsPath(addPath(top_srcdir(), "lib"),
+ addPath(binary_dir, "support"));
- if (!FileSearch(system_support_dir, "chkconfig.ltx").empty()) {
+ if (!fileSearch(system_support_dir, "chkconfig.ltx").empty()) {
lyxerr[Debug::INIT] << check_text << " yes"
<< std::endl;
return std::make_pair(build_support_dir, system_support_dir);
break;
string link;
- if (LyXReadLink(binary, link, true)) {
+ if (readLink(binary, link, true)) {
binary = link;
} else {
// Unable to resolve the link.
// 2. Search for system_support_dir / <relative locale dir>
// The <relative locale dir> is OS-dependent. (On Unix, it will
// be "../locale/".)
- path = NormalizePath(AddPath(system_support_dir, relative_locale_dir()));
+ path = normalizePath(addPath(system_support_dir, relative_locale_dir()));
if (fs::exists(path) && fs::is_directory(path))
return path;
return string();
string const path = os::internal_path(command_line);
- return os::is_absolute_path(path) ? path : MakeAbsPath(path);
+ return os::is_absolute_path(path) ? path : makeAbsPath(path);
}
// Two possibilities present themselves.
// 1. The binary is relative to the CWD.
- string const abs_exe_path = MakeAbsPath(exe_path);
+ string const abs_exe_path = makeAbsPath(exe_path);
if (fs::exists(abs_exe_path))
return abs_exe_path;
// 2. exe must be the name of the binary only and it
// can be found on the PATH.
- string const exe_name = OnlyFilename(exe_path);
+ string const exe_name = onlyFilename(exe_path);
if (exe_name != exe_path)
return string();
std::vector<string>::const_iterator const end = path.end();
for (; it != end; ++it) {
// This will do nothing if *it is already absolute.
- string const exe_dir = MakeAbsPath(*it);
+ string const exe_dir = makeAbsPath(*it);
- string const exe_path = AddName(exe_dir, exe_name);
+ string const exe_path = addName(exe_dir, exe_name);
if (fs::exists(exe_path))
return exe_path;
}
string binary = abs_binary;
while (true) {
// Try and find "chkconfig.ltx".
- string const binary_dir = OnlyPath(binary);
+ string const binary_dir = onlyPath(binary);
string const lyxdir =
- NormalizePath(AddPath(binary_dir, relative_lyxdir));
+ normalizePath(addPath(binary_dir, relative_lyxdir));
searched_dirs.push_back(lyxdir);
- if (!FileSearch(lyxdir, chkconfig_ltx).empty()) {
+ if (!fileSearch(lyxdir, chkconfig_ltx).empty()) {
// Success! "chkconfig.ltx" has been found.
return lyxdir;
}
break;
string link;
- if (LyXReadLink(binary, link, true)) {
+ if (readLink(binary, link, true)) {
binary = link;
} else {
// Unable to resolve the link.
}
// 4. Repeat the exercise on the directory itself.
- string binary_dir = OnlyPath(abs_binary);
+ string binary_dir = onlyPath(abs_binary);
while (true) {
// This time test whether the directory is a symbolic link
// *before* looking for "chkconfig.ltx".
break;
string link;
- if (LyXReadLink(binary_dir, link, true)) {
+ if (readLink(binary_dir, link, true)) {
binary_dir = link;
} else {
// Unable to resolve the link.
// Try and find "chkconfig.ltx".
string const lyxdir =
- NormalizePath(AddPath(binary_dir, relative_lyxdir));
+ normalizePath(addPath(binary_dir, relative_lyxdir));
searched_dirs.push_back(lyxdir);
- if (!FileSearch(lyxdir, chkconfig_ltx).empty()) {
+ if (!fileSearch(lyxdir, chkconfig_ltx).empty()) {
// Success! "chkconfig.ltx" has been found.
return lyxdir;
}
// 5. In desparation, try the hard-coded system support dir.
path = hardcoded_system_support_dir();
- if (!FileSearch(path, chkconfig_ltx).empty())
+ if (!fileSearch(path, chkconfig_ltx).empty())
return path;
// Everything has failed :-(
(void)home_dir; // Silence warning about unused variable.
os::GetFolderPath win32_folder_path;
- return AddPath(win32_folder_path(os::GetFolderPath::APPDATA), PACKAGE);
+ return addPath(win32_folder_path(os::GetFolderPath::APPDATA), PACKAGE);
#elif defined (USE_MACOSX_PACKAGING)
(void)home_dir; // Silence warning about unused variable.
if (status_code != 0)
return string();
- return AddPath(reinterpret_cast<char const *>(store), PACKAGE);
+ return addPath(reinterpret_cast<char const *>(store), PACKAGE);
#else // USE_POSIX_PACKAGING
- return AddPath(home_dir, string(".") + PACKAGE);
+ return addPath(home_dir, string(".") + PACKAGE);
#endif
}
string const & file,
string const & command_line_switch)
{
- string const abs_path = FileSearch(dir, file);
+ string const abs_path = fileSearch(dir, file);
if (abs_path.empty()) {
lyxerr << bformat(_("Invalid %1$s switch.\n"
"Directory %2$s does not contain %3$s."),
string const extract_env_var_dir(string const & env_var)
{
string const dir = os::internal_path(getEnv(env_var));
- return dir.empty() ? dir : MakeAbsPath(dir);
+ return dir.empty() ? dir : makeAbsPath(dir);
}
string const & file,
string const & env_var)
{
- string const abs_path = FileSearch(dir, file);
+ string const abs_path = fileSearch(dir, file);
if (abs_path.empty()) {
lyxerr << bformat(_("Invalid %1$s environment variable.\n"
"Directory %2$s does not contain %3$s."),
- env_var, dir, file)
+ env_var, dir, file)
<< std::endl;
}
#if defined (USE_WINDOWS_PACKAGING) || defined (USE_MACOSX_PACKAGING)
result = "../Resources/";
#else // Posix-like.
- result = AddPath("../share/", PACKAGE);
+ result = addPath("../share/", PACKAGE);
#endif
return result;
string const lyx::support::tempName(string const & dir, string const & mask)
{
string const tmpdir(dir.empty() ? package().temp_dir() : dir);
- string tmpfl(AddName(tmpdir, mask));
+ string tmpfl(addName(tmpdir, mask));
#if defined (HAVE_GETPID)
tmpfl += convert<string>(getpid());
#elif defined (HAVE__GETPID)
return str;
}
-void test_NormalizePath()
+void test_normalizePath()
{
- cout << NormalizePath("foo/../bar") << endl;
- cout << NormalizePath("foo/./bar") << endl;
- cout << NormalizePath("./foo/../bar") << endl;
- cout << NormalizePath("./foo/./bar") << endl;
- cout << NormalizePath("/foo/../bar") << endl;
- cout << NormalizePath("/foo/./bar") << endl;
- cout << NormalizePath("foo//bar") << endl;
- cout << NormalizePath("./foo//bar") << endl;
- cout << NormalizePath("/foo//bar") << endl;
+ cout << normalizePath("foo/../bar") << endl;
+ cout << normalizePath("foo/./bar") << endl;
+ cout << normalizePath("./foo/../bar") << endl;
+ cout << normalizePath("./foo/./bar") << endl;
+ cout << normalizePath("/foo/../bar") << endl;
+ cout << normalizePath("/foo/./bar") << endl;
+ cout << normalizePath("foo//bar") << endl;
+ cout << normalizePath("./foo//bar") << endl;
+ cout << normalizePath("/foo//bar") << endl;
}
int main()
{
- test_NormalizePath();
+ test_normalizePath();
}
using std::cerr;
using std::endl;
-using lyx::support::LibFileSearch;
+using lyx::support::libFileSearch;
// special columntypes
extern std::map<char, int> special_columns;
if (!forceclass.empty()) {
h_textclass = forceclass;
}
- string layoutfilename = LibFileSearch("layouts", h_textclass, "layout");
+ string layoutfilename = libFileSearch("layouts", h_textclass, "layout");
if (layoutfilename.empty()) {
cerr << "Error: Could not find layout file for textclass \"" << h_textclass << "\"." << endl;
exit(1);
using std::vector;
using std::map;
-using lyx::support::ChangeExtension;
+using lyx::support::changeExtension;
using lyx::support::isStrUnsignedInt;
using lyx::support::ltrim;
-using lyx::support::MakeAbsPath;
-using lyx::support::OnlyPath;
+using lyx::support::makeAbsPath;
+using lyx::support::onlyPath;
using lyx::support::rtrim;
using lyx::support::isFileReadable;
/// convert TeX from \p infilename to LyX and write it to \p os
bool tex2lyx(string const &infilename, std::ostream &os)
{
- BOOST_ASSERT(lyx::support::AbsolutePath(infilename));
+ BOOST_ASSERT(lyx::support::absolutePath(infilename));
ifstream is(infilename.c_str());
if (!is.good()) {
cerr << "Could not open input file \"" << infilename
return false;
}
string const oldParentFilePath = parentFilePath;
- parentFilePath = OnlyPath(infilename);
+ parentFilePath = onlyPath(infilename);
tex2lyx(is, os);
parentFilePath = oldParentFilePath;
return true;
// Now every known option is parsed. Look for input and output
// file name (the latter is optional).
- string const infilename = MakeAbsPath(argv[1]);
+ string const infilename = makeAbsPath(argv[1]);
string outfilename;
if (argc > 2) {
outfilename = argv[2];
if (outfilename != "-")
- outfilename = MakeAbsPath(argv[2]);
+ outfilename = makeAbsPath(argv[2]);
} else
- outfilename = ChangeExtension(infilename, ".lyx");
+ outfilename = changeExtension(infilename, ".lyx");
- string const system_syntaxfile = lyx::support::LibFileSearch("", "syntax.default");
+ string const system_syntaxfile = lyx::support::libFileSearch("", "syntax.default");
if (system_syntaxfile.empty()) {
cerr << "Error: Could not find syntax file \"syntax.default\"." << endl;
exit(1);
if (!syntaxfile.empty())
read_syntaxfile(syntaxfile);
- masterFilePath = OnlyPath(infilename);
+ masterFilePath = onlyPath(infilename);
parentFilePath = masterFilePath;
if (outfilename == "-") {
#include <sstream>
#include <vector>
-using lyx::support::ChangeExtension;
-using lyx::support::MakeAbsPath;
-using lyx::support::MakeRelPath;
+using lyx::support::changeExtension;
+using lyx::support::makeAbsPath;
+using lyx::support::makeRelPath;
using lyx::support::rtrim;
using lyx::support::suffixIs;
using lyx::support::contains;
// We don't use ChangeExtension() because it does the wrong
// thing if name contains a dot.
string const trial = name + '.' + (*what);
- if (fs::exists(MakeAbsPath(trial, path)))
+ if (fs::exists(makeAbsPath(trial, path)))
return trial;
}
return string();
/// convention (relative to .lyx file) if it is relative
void fix_relative_filename(string & name)
{
- if (lyx::support::AbsolutePath(name))
+ if (lyx::support::absolutePath(name))
return;
- name = MakeRelPath(MakeAbsPath(name, getMasterFilePath()),
+ name = makeRelPath(makeAbsPath(name, getMasterFilePath()),
getParentFilePath());
}
string const path = getMasterFilePath();
// We want to preserve relative / absolute filenames,
// therefore path is only used for testing
- if (!fs::exists(MakeAbsPath(name, path))) {
+ if (!fs::exists(makeAbsPath(name, path))) {
// The file extension is probably missing.
// Now try to find it out.
string const dvips_name =
name = pdftex_name;
}
- if (fs::exists(MakeAbsPath(name, path)))
+ if (fs::exists(makeAbsPath(name, path)))
fix_relative_filename(name);
else
cerr << "Warning: Could not find graphics file '"
// We want to preserve relative / absolute filenames,
// therefore path is only used for testing
if (t.cs() == "include" &&
- !fs::exists(MakeAbsPath(filename, path))) {
+ !fs::exists(makeAbsPath(filename, path))) {
// The file extension is probably missing.
// Now try to find it out.
string const tex_name =
if (!tex_name.empty())
filename = tex_name;
}
- if (fs::exists(MakeAbsPath(filename, path))) {
+ if (fs::exists(makeAbsPath(filename, path))) {
string const abstexname =
- MakeAbsPath(filename, path);
+ makeAbsPath(filename, path);
string const abslyxname =
- ChangeExtension(abstexname, ".lyx");
+ changeExtension(abstexname, ".lyx");
fix_relative_filename(filename);
string const lyxname =
- ChangeExtension(filename, ".lyx");
+ changeExtension(filename, ".lyx");
if (t.cs() != "verbatiminput" &&
tex2lyx(abstexname, abslyxname)) {
os << name << '{' << lyxname << "}\n";
#include "trans_mgr.h"
using lyx::support::contains;
-using lyx::support::LibFileSearch;
+using lyx::support::libFileSearch;
using std::endl;
using std::string;
int Trans::Load(string const & language)
{
- string const filename = LibFileSearch("kbd", language, "kmap");
+ string const filename = libFileSearch("kbd", language, "kmap");
if (filename.empty())
return -1;
#include <fstream>
-using lyx::support::AddName;
-using lyx::support::AddPath;
+using lyx::support::addName;
+using lyx::support::addPath;
using lyx::support::contains;
-using lyx::support::OnlyFilename;
-using lyx::support::OnlyPath;
+using lyx::support::onlyFilename;
+using lyx::support::onlyPath;
using lyx::support::Path;
-using lyx::support::QuoteName;
+using lyx::support::quoteName;
using lyx::support::rtrim;
using lyx::support::split;
using lyx::support::Systemcall;
return tmp;
} else {
// Check if RCS/*,v exists.
- tmp = AddName(AddPath(OnlyPath(file), "RCS"), file);
+ tmp = addName(addPath(onlyPath(file), "RCS"), file);
tmp += ",v";
lyxerr[Debug::LYXVC] << "Checking if file is under rcs: "
<< tmp << endl;
void RCS::retrieve(string const & file)
{
lyxerr[Debug::LYXVC] << "LyXVC::RCS: retrieve.\n\t" << file << endl;
- VCS::doVCCommand("co -q -r " + QuoteName(file),
+ VCS::doVCCommand("co -q -r " + quoteName(file),
string());
}
string cmd = "ci -q -u -i -t-\"";
cmd += msg;
cmd += "\" ";
- cmd += QuoteName(OnlyFilename(owner_->fileName()));
+ cmd += quoteName(onlyFilename(owner_->fileName()));
doVCCommand(cmd, owner_->filePath());
}
void RCS::checkIn(string const & msg)
{
doVCCommand("ci -q -u -m\"" + msg + "\" "
- + QuoteName(OnlyFilename(owner_->fileName())),
+ + quoteName(onlyFilename(owner_->fileName())),
owner_->filePath());
}
void RCS::checkOut()
{
owner_->markClean();
- doVCCommand("co -q -l " + QuoteName(OnlyFilename(owner_->fileName())),
+ doVCCommand("co -q -l " + quoteName(onlyFilename(owner_->fileName())),
owner_->filePath());
}
void RCS::revert()
{
doVCCommand("co -f -u" + version() + " "
- + QuoteName(OnlyFilename(owner_->fileName())),
+ + quoteName(onlyFilename(owner_->fileName())),
owner_->filePath());
// We ignore changes and just reload!
owner_->markClean();
{
lyxerr[Debug::LYXVC] << "LyXVC: undoLast" << endl;
doVCCommand("rcs -o" + version() + " "
- + QuoteName(OnlyFilename(owner_->fileName())),
+ + quoteName(onlyFilename(owner_->fileName())),
owner_->filePath());
}
void RCS::getLog(string const & tmpf)
{
- doVCCommand("rlog " + QuoteName(OnlyFilename(owner_->fileName()))
+ doVCCommand("rlog " + quoteName(onlyFilename(owner_->fileName()))
+ " > " + tmpf,
owner_->filePath());
}
{
// First we look for the CVS/Entries in the same dir
// where we have file.
- string const dir = OnlyPath(file) + "/CVS/Entries";
- string const tmpf = "/" + OnlyFilename(file) + "/";
+ string const dir = onlyPath(file) + "/CVS/Entries";
+ string const tmpf = "/" + onlyFilename(file) + "/";
lyxerr[Debug::LYXVC] << "LyXVC: checking in `" << dir
<< "' for `" << tmpf << '\'' << endl;
if (fs::is_readable(dir)) {
<< master_ << endl;
// Ok now we do the real scan...
ifstream ifs(master_.c_str());
- string tmpf = "/" + OnlyFilename(file_) + "/";
+ string tmpf = "/" + onlyFilename(file_) + "/";
lyxerr[Debug::LYXVC] << "\tlooking for `" << tmpf << '\'' << endl;
string line;
static regex const reg("/(.*)/(.*)/(.*)/(.*)/(.*)");
void CVS::registrer(string const & msg)
{
doVCCommand("cvs -q add -m \"" + msg + "\" "
- + QuoteName(OnlyFilename(owner_->fileName())),
+ + quoteName(onlyFilename(owner_->fileName())),
owner_->filePath());
}
void CVS::checkIn(string const & msg)
{
doVCCommand("cvs -q commit -m \"" + msg + "\" "
- + QuoteName(OnlyFilename(owner_->fileName())),
+ + quoteName(onlyFilename(owner_->fileName())),
owner_->filePath());
}
{
// Reverts to the version in CVS repository and
// gets the updated version from the repository.
- string const fil = QuoteName(OnlyFilename(owner_->fileName()));
+ string const fil = quoteName(onlyFilename(owner_->fileName()));
doVCCommand("rm -f " + fil + "; cvs update " + fil,
owner_->filePath());
void CVS::getLog(string const & tmpf)
{
- doVCCommand("cvs log " + QuoteName(OnlyFilename(owner_->fileName()))
+ doVCCommand("cvs log " + quoteName(onlyFilename(owner_->fileName()))
+ " > " + tmpf,
owner_->filePath());
}