mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 10:00:33 +00:00
some std::string -> filename changes
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21404 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
2fbc75b552
commit
09b7e6e60a
@ -1700,6 +1700,12 @@ void Buffer::markDirty()
|
||||
}
|
||||
|
||||
|
||||
FileName Buffer::fileName() const
|
||||
{
|
||||
return pimpl_->filename;
|
||||
}
|
||||
|
||||
|
||||
string Buffer::absFileName() const
|
||||
{
|
||||
return pimpl_->filename.absFilename();
|
||||
|
@ -236,6 +236,9 @@ public:
|
||||
/// Mark this buffer as dirty.
|
||||
void markDirty();
|
||||
|
||||
/// Returns the buffer's filename. It is always an absolute path.
|
||||
support::FileName fileName() const;
|
||||
|
||||
/// Returns the buffer's filename. It is always an absolute path.
|
||||
std::string absFileName() const;
|
||||
|
||||
|
@ -99,10 +99,12 @@ bool BufferList::quitWriteBuffer(Buffer * buf)
|
||||
BOOST_ASSERT(buf);
|
||||
|
||||
docstring file;
|
||||
|
||||
// FIXME: Unicode?
|
||||
if (buf->isUnnamed())
|
||||
file = from_utf8(onlyFilename(buf->absFileName()));
|
||||
file = from_utf8(buf->fileName().onlyFileName());
|
||||
else
|
||||
file = makeDisplayPath(buf->absFileName(), 30);
|
||||
file = buf->fileName().displayName(30);
|
||||
|
||||
docstring const text =
|
||||
bformat(_("The document %1$s has unsaved changes.\n\n"
|
||||
|
@ -14,8 +14,6 @@
|
||||
|
||||
#include "support/docstring.h"
|
||||
|
||||
#include <boost/noncopyable.hpp>
|
||||
|
||||
#include <vector>
|
||||
|
||||
|
||||
@ -28,7 +26,7 @@ class OutputParams;
|
||||
* The class holds all all open buffers, and handles construction
|
||||
* and deletions of new ones.
|
||||
*/
|
||||
class BufferList : boost::noncopyable {
|
||||
class BufferList {
|
||||
public:
|
||||
typedef std::vector<Buffer *>::iterator iterator;
|
||||
typedef std::vector<Buffer *>::const_iterator const_iterator;
|
||||
@ -106,6 +104,10 @@ public:
|
||||
void setCurrentAuthor(docstring const & name, docstring const & email);
|
||||
|
||||
private:
|
||||
/// noncopiable
|
||||
BufferList(BufferList const &);
|
||||
void operator=(BufferList const &);
|
||||
|
||||
/// ask to save a buffer on quit, returns false if should cancel
|
||||
bool quitWriteBuffer(Buffer * buf);
|
||||
|
||||
|
@ -423,8 +423,7 @@ BufferView::~BufferView()
|
||||
LastFilePosSection::FilePos fp;
|
||||
fp.pit = d->cursor_.bottom().pit();
|
||||
fp.pos = d->cursor_.bottom().pos();
|
||||
LyX::ref().session().lastFilePos().save(
|
||||
support::FileName(buffer_.absFileName()), fp);
|
||||
LyX::ref().session().lastFilePos().save(buffer_.fileName(), fp);
|
||||
|
||||
delete d;
|
||||
}
|
||||
@ -724,7 +723,7 @@ void BufferView::saveBookmark(unsigned int idx)
|
||||
// pit and pos will be updated with bottom level pit/pos
|
||||
// when lyx exits.
|
||||
LyX::ref().session().bookmarks().save(
|
||||
FileName(buffer_.absFileName()),
|
||||
buffer_.fileName(),
|
||||
d->cursor_.bottom().pit(),
|
||||
d->cursor_.bottom().pos(),
|
||||
d->cursor_.paragraph().id(),
|
||||
|
@ -60,7 +60,6 @@ using support::FileName;
|
||||
using support::DocFileName;
|
||||
using support::makeAbsPath;
|
||||
using support::addName;
|
||||
using support::onlyPath;
|
||||
using support::absolutePath;
|
||||
using support::onlyFilename;
|
||||
using support::makeRelPath;
|
||||
@ -155,7 +154,7 @@ bool EmbeddedFile::extract(Buffer const * buf) const
|
||||
// copy file
|
||||
try {
|
||||
// need to make directory?
|
||||
string path = onlyPath(ext_file);
|
||||
string path = support::onlyPath(ext_file);
|
||||
if (!fs::is_directory(path))
|
||||
makedir(const_cast<char*>(path.c_str()), 0755);
|
||||
fs::copy_file(emb_file, ext_file, false);
|
||||
@ -197,7 +196,7 @@ bool EmbeddedFile::updateFromExternalFile(Buffer const * buf) const
|
||||
// copy file
|
||||
try {
|
||||
// need to make directory?
|
||||
string path = onlyPath(emb_file);
|
||||
string path = support::onlyPath(emb_file);
|
||||
if (!fs::is_directory(path))
|
||||
makedir(const_cast<char*>(path.c_str()), 0755);
|
||||
fs::copy_file(ext_file, emb_file, false);
|
||||
|
@ -16,10 +16,6 @@
|
||||
#include "support/FileName.h"
|
||||
|
||||
#include <vector>
|
||||
#include <utility>
|
||||
|
||||
#include "ParIterator.h"
|
||||
#include "Paragraph.h"
|
||||
|
||||
/**
|
||||
|
||||
@ -91,6 +87,7 @@ is why external filename will exist even if a file is at "EMBEDDED" status.
|
||||
namespace lyx {
|
||||
|
||||
class Buffer;
|
||||
class Inset;
|
||||
class Lexer;
|
||||
class ErrorList;
|
||||
|
||||
|
@ -97,7 +97,6 @@
|
||||
#include "support/os.h"
|
||||
|
||||
#include <boost/current_function.hpp>
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
|
||||
#include <sstream>
|
||||
|
||||
@ -110,8 +109,6 @@ using std::ostringstream;
|
||||
using std::find;
|
||||
using std::vector;
|
||||
|
||||
namespace fs = boost::filesystem;
|
||||
|
||||
namespace lyx {
|
||||
|
||||
using frontend::LyXView;
|
||||
@ -604,7 +601,7 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
|
||||
enable = buf->lyxvc().inUse();
|
||||
break;
|
||||
case LFUN_BUFFER_RELOAD:
|
||||
enable = !buf->isUnnamed() && fs::exists(buf->absFileName())
|
||||
enable = !buf->isUnnamed() && buf->fileName().exists()
|
||||
&& (!buf->isClean() || buf->isExternallyModified(Buffer::timestamp_method));
|
||||
break;
|
||||
|
||||
@ -856,7 +853,7 @@ bool LyXFunc::ensureBufferClean(BufferView * bv)
|
||||
if (buf.isClean())
|
||||
return true;
|
||||
|
||||
docstring const file = makeDisplayPath(buf.absFileName(), 30);
|
||||
docstring const file = buf.fileName().displayName(30);
|
||||
docstring text = bformat(_("The document %1$s has unsaved "
|
||||
"changes.\n\nDo you want to save "
|
||||
"the document?"), file);
|
||||
|
@ -32,7 +32,6 @@ namespace lyx {
|
||||
using support::bformat;
|
||||
using support::FileName;
|
||||
using support::makeAbsPath;
|
||||
using support::makeDisplayPath;
|
||||
using support::tempName;
|
||||
|
||||
using std::endl;
|
||||
@ -92,7 +91,7 @@ void LyXVC::setBuffer(Buffer * buf)
|
||||
|
||||
void LyXVC::registrer()
|
||||
{
|
||||
FileName const filename(owner_->absFileName());
|
||||
FileName const filename = owner_->fileName();
|
||||
|
||||
// there must be a file to save
|
||||
if (!filename.isFileReadable()) {
|
||||
@ -109,14 +108,14 @@ void LyXVC::registrer()
|
||||
if (cvs_entries.isFileReadable()) {
|
||||
LYXERR(Debug::LYXVC)
|
||||
<< "LyXVC: registering "
|
||||
<< to_utf8(makeDisplayPath(filename.absFilename()))
|
||||
<< to_utf8(filename.displayName())
|
||||
<< " with CVS" << endl;
|
||||
vcs.reset(new CVS(cvs_entries, filename));
|
||||
|
||||
} else {
|
||||
LYXERR(Debug::LYXVC)
|
||||
<< "LyXVC: registering "
|
||||
<< to_utf8(makeDisplayPath(filename.absFilename()))
|
||||
<< to_utf8(filename.displayName())
|
||||
<< " with RCS" << endl;
|
||||
vcs.reset(new RCS(filename));
|
||||
}
|
||||
@ -166,7 +165,7 @@ void LyXVC::revert()
|
||||
{
|
||||
LYXERR(Debug::LYXVC) << "LyXVC: revert" << endl;
|
||||
|
||||
docstring const file = makeDisplayPath(owner_->absFileName(), 20);
|
||||
docstring const file = owner_->fileName().displayName(20);
|
||||
docstring 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);
|
||||
|
@ -139,16 +139,14 @@ docstring const MenuItem::binding(bool forgui) const
|
||||
// first one later
|
||||
KeyMap::Bindings bindings = theTopLevelKeymap().findBindings(func_);
|
||||
|
||||
if (bindings.size()) {
|
||||
if (bindings.size())
|
||||
return bindings.begin()->print(KeySequence::ForGui);
|
||||
} else {
|
||||
LYXERR(Debug::KBMAP)
|
||||
<< "No binding for "
|
||||
<< lyxaction.getActionName(func_.action)
|
||||
<< '(' << to_utf8(func_.argument()) << ')' << endl;
|
||||
return docstring();
|
||||
}
|
||||
|
||||
LYXERR(Debug::KBMAP)
|
||||
<< "No binding for "
|
||||
<< lyxaction.getActionName(func_.action)
|
||||
<< '(' << to_utf8(func_.argument()) << ')' << endl;
|
||||
return docstring();
|
||||
}
|
||||
|
||||
|
||||
@ -494,8 +492,9 @@ void expandDocuments(Menu & tomenu)
|
||||
|
||||
// We cannot use a for loop as the buffer list cycles.
|
||||
do {
|
||||
docstring label = makeDisplayPath(b->absFileName(), 20);
|
||||
if (!b->isClean()) label = label + "*";
|
||||
docstring label = b->fileName().displayName(20);
|
||||
if (!b->isClean())
|
||||
label = label + "*";
|
||||
if (ii < 10)
|
||||
label = convert<docstring>(ii) + ". " + label + '|' + convert<docstring>(ii);
|
||||
tomenu.add(MenuItem(MenuItem::Command, label,
|
||||
@ -507,7 +506,6 @@ void expandDocuments(Menu & tomenu)
|
||||
} else {
|
||||
tomenu.add(MenuItem(MenuItem::Command, _("No Documents Open!"),
|
||||
FuncRequest(LFUN_NOACTION)));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -186,7 +186,7 @@ static void specialChar(Cursor & cur, InsetSpecialChar::Kind kind)
|
||||
static bool doInsertInset(Cursor & cur, Text * text,
|
||||
FuncRequest const & cmd, bool edit, bool pastesel)
|
||||
{
|
||||
Inset * inset = createInset(&cur.bv(), cmd);
|
||||
Inset * inset = createInset(cur.bv().buffer(), cmd);
|
||||
if (!inset)
|
||||
return false;
|
||||
|
||||
@ -687,7 +687,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
|
||||
|
||||
case LFUN_INSET_INSERT: {
|
||||
cur.recordUndo();
|
||||
Inset * inset = createInset(bv, cmd);
|
||||
Inset * inset = createInset(bv->buffer(), cmd);
|
||||
if (inset) {
|
||||
// FIXME (Abdel 01/02/2006):
|
||||
// What follows would be a partial fix for bug 2154:
|
||||
@ -1144,7 +1144,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
|
||||
}
|
||||
|
||||
case LFUN_INFO_INSERT: {
|
||||
Inset * inset = createInset(&cur.bv(), cmd);
|
||||
Inset * inset = createInset(cur.bv().buffer(), cmd);
|
||||
if (!inset)
|
||||
break;
|
||||
// if an empty inset is created (cmd.argument() is empty)
|
||||
@ -1244,8 +1244,13 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
|
||||
doInsertInset(cur, this, cmd, true, true);
|
||||
cur.posRight();
|
||||
break;
|
||||
|
||||
case LFUN_NOMENCL_INSERT: {
|
||||
Inset * inset = createInset(&cur.bv(), cmd);
|
||||
FuncRequest cmd1 = cmd;
|
||||
if (cmd.argument().empty())
|
||||
cmd1 = FuncRequest(cmd,
|
||||
bv->cursor().innerText()->getStringToIndex(bv->cursor()));
|
||||
Inset * inset = createInset(cur.bv().buffer(), cmd1);
|
||||
if (!inset)
|
||||
break;
|
||||
cur.recordUndo();
|
||||
|
@ -13,7 +13,6 @@
|
||||
#include "factory.h"
|
||||
|
||||
#include "Buffer.h"
|
||||
#include "BufferView.h"
|
||||
#include "BufferParams.h"
|
||||
#include "debug.h"
|
||||
#include "FloatList.h"
|
||||
@ -80,9 +79,9 @@ namespace Alert = frontend::Alert;
|
||||
using support::compare_ascii_no_case;
|
||||
|
||||
|
||||
Inset * createInset(BufferView * bv, FuncRequest const & cmd)
|
||||
Inset * createInset(Buffer & buf, FuncRequest const & cmd)
|
||||
{
|
||||
BufferParams const & params = bv->buffer().params();
|
||||
BufferParams const & params = buf.params();
|
||||
|
||||
try {
|
||||
|
||||
@ -154,7 +153,6 @@ Inset * createInset(BufferView * bv, FuncRequest const & cmd)
|
||||
if (params.getTextClass().floats().typeExist(argument))
|
||||
return new InsetFloat(params, argument);
|
||||
lyxerr << "Non-existent float type: " << argument << endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
case LFUN_FLOAT_WIDE_INSERT: {
|
||||
@ -182,9 +180,7 @@ Inset * createInset(BufferView * bv, FuncRequest const & cmd)
|
||||
|
||||
case LFUN_NOMENCL_INSERT: {
|
||||
InsetCommandParams icp(NOMENCL_CODE);
|
||||
icp["symbol"] = cmd.argument().empty() ?
|
||||
bv->cursor().innerText()->getStringToIndex(bv->cursor()) :
|
||||
cmd.argument();
|
||||
icp["symbol"] = cmd.argument();
|
||||
return new InsetNomencl(icp);
|
||||
}
|
||||
|
||||
@ -198,7 +194,7 @@ Inset * createInset(BufferView * bv, FuncRequest const & cmd)
|
||||
r = 2;
|
||||
if (c <= 0)
|
||||
c = 2;
|
||||
return new InsetTabular(bv->buffer(), r, c);
|
||||
return new InsetTabular(buf, r, c);
|
||||
}
|
||||
|
||||
case LFUN_CAPTION_INSERT: {
|
||||
@ -267,18 +263,16 @@ Inset * createInset(BufferView * bv, FuncRequest const & cmd)
|
||||
}
|
||||
|
||||
case EXTERNAL_CODE: {
|
||||
Buffer const & buffer = bv->buffer();
|
||||
InsetExternalParams iep;
|
||||
InsetExternalMailer::string2params(to_utf8(cmd.argument()), buffer, iep);
|
||||
InsetExternalMailer::string2params(to_utf8(cmd.argument()), buf, iep);
|
||||
auto_ptr<InsetExternal> inset(new InsetExternal);
|
||||
inset->setParams(iep, buffer);
|
||||
inset->setParams(iep, buf);
|
||||
return inset.release();
|
||||
}
|
||||
|
||||
case GRAPHICS_CODE: {
|
||||
Buffer const & buffer = bv->buffer();
|
||||
InsetGraphicsParams igp;
|
||||
InsetGraphicsMailer::string2params(to_utf8(cmd.argument()), buffer, igp);
|
||||
InsetGraphicsMailer::string2params(to_utf8(cmd.argument()), buf, igp);
|
||||
auto_ptr<InsetGraphics> inset(new InsetGraphics);
|
||||
inset->setParams(igp);
|
||||
return inset.release();
|
||||
@ -314,7 +308,7 @@ Inset * createInset(BufferView * bv, FuncRequest const & cmd)
|
||||
case REF_CODE: {
|
||||
InsetCommandParams icp(code);
|
||||
InsetCommandMailer::string2params(name, to_utf8(cmd.argument()), icp);
|
||||
return new InsetRef(icp, bv->buffer());
|
||||
return new InsetRef(icp, buf);
|
||||
}
|
||||
|
||||
case TOC_CODE: {
|
||||
@ -341,21 +335,21 @@ Inset * createInset(BufferView * bv, FuncRequest const & cmd)
|
||||
string const name = to_utf8(cmd.argument());
|
||||
if (name == "normal")
|
||||
return new InsetSpace(InsetSpace::NORMAL);
|
||||
else if (name == "protected")
|
||||
if (name == "protected")
|
||||
return new InsetSpace(InsetSpace::PROTECTED);
|
||||
else if (name == "thin")
|
||||
if (name == "thin")
|
||||
return new InsetSpace(InsetSpace::THIN);
|
||||
else if (name == "quad")
|
||||
if (name == "quad")
|
||||
return new InsetSpace(InsetSpace::QUAD);
|
||||
else if (name == "qquad")
|
||||
if (name == "qquad")
|
||||
return new InsetSpace(InsetSpace::QQUAD);
|
||||
else if (name == "enspace")
|
||||
if (name == "enspace")
|
||||
return new InsetSpace(InsetSpace::ENSPACE);
|
||||
else if (name == "enskip")
|
||||
if (name == "enskip")
|
||||
return new InsetSpace(InsetSpace::ENSKIP);
|
||||
else if (name == "negthinspace")
|
||||
if (name == "negthinspace")
|
||||
return new InsetSpace(InsetSpace::NEGTHIN);
|
||||
else if (name.empty())
|
||||
if (name.empty())
|
||||
lyxerr << "LyX function 'space' needs an argument." << endl;
|
||||
else
|
||||
lyxerr << "Wrong argument for LyX function 'space'." << endl;
|
||||
|
@ -15,14 +15,13 @@
|
||||
namespace lyx {
|
||||
|
||||
class Buffer;
|
||||
class BufferView;
|
||||
class FuncRequest;
|
||||
class Inset;
|
||||
class Lexer;
|
||||
|
||||
|
||||
/// creates inset according to 'cmd'
|
||||
Inset * createInset(BufferView * bv, FuncRequest const & cmd);
|
||||
Inset * createInset(Buffer & buf, FuncRequest const & cmd);
|
||||
|
||||
/// read inset from a file
|
||||
Inset * readInset(Lexer & lex, Buffer const & buf);
|
||||
|
@ -544,7 +544,7 @@ void GuiViewBase::setWindowTitle(docstring const & t, docstring const & it)
|
||||
}
|
||||
if (Buffer const * buf = buffer())
|
||||
d.tab_widget_->setTabText(d.tab_widget_->currentIndex(),
|
||||
toqstr(makeDisplayPath(buf->absFileName(), 30)));
|
||||
toqstr(buf->fileName().displayName(30)));
|
||||
}
|
||||
|
||||
|
||||
@ -809,7 +809,7 @@ WorkArea * GuiViewBase::addWorkArea(Buffer & buffer)
|
||||
{
|
||||
GuiWorkArea * wa = new GuiWorkArea(buffer, *this);
|
||||
wa->setUpdatesEnabled(false);
|
||||
d.tab_widget_->addTab(wa, toqstr(makeDisplayPath(buffer.absFileName(), 30)));
|
||||
d.tab_widget_->addTab(wa, toqstr(buffer.fileName().displayName(30)));
|
||||
wa->bufferView().updateMetrics(false);
|
||||
if (d.stack_widget_)
|
||||
d.stack_widget_->setCurrentWidget(d.tab_widget_);
|
||||
|
@ -67,7 +67,6 @@ using support::isLyXFilename;
|
||||
using support::isValidLaTeXFilename;
|
||||
using support::latex_path;
|
||||
using support::makeAbsPath;
|
||||
using support::makeDisplayPath;
|
||||
using support::makeRelPath;
|
||||
using support::onlyFilename;
|
||||
using support::onlyPath;
|
||||
@ -101,7 +100,8 @@ enum Types {
|
||||
};
|
||||
|
||||
|
||||
Types type(std::string const & s) {
|
||||
Types type(std::string const & s)
|
||||
{
|
||||
if (s == "input")
|
||||
return INPUT;
|
||||
if (s == "verbatiminput")
|
||||
@ -118,8 +118,7 @@ Types type(std::string const & s) {
|
||||
|
||||
Types type(InsetCommandParams const & params)
|
||||
{
|
||||
string const command_name = params.getCmdName();
|
||||
return type(command_name);
|
||||
return type(params.getCmdName());
|
||||
}
|
||||
|
||||
|
||||
@ -163,8 +162,8 @@ InsetInclude::InsetInclude(InsetInclude const & other)
|
||||
|
||||
CommandInfo const * InsetInclude::findInfo(std::string const & /* cmdName */)
|
||||
{
|
||||
//This is only correct for the case of listings, but it'll do for now.
|
||||
//In the other cases, this second parameter should just be empty.
|
||||
// This is only correct for the case of listings, but it'll do for now.
|
||||
// In the other cases, this second parameter should just be empty.
|
||||
static const char * const paramnames[] = {"filename", "lstparams", ""};
|
||||
static const bool isoptional[] = {false, true};
|
||||
static const CommandInfo info = {2, paramnames, isoptional};
|
||||
@ -172,7 +171,8 @@ CommandInfo const * InsetInclude::findInfo(std::string const & /* cmdName */)
|
||||
}
|
||||
|
||||
|
||||
bool InsetInclude::isCompatibleCommand(std::string const & s) {
|
||||
bool InsetInclude::isCompatibleCommand(std::string const & s)
|
||||
{
|
||||
return type(s) != NONE;
|
||||
}
|
||||
|
||||
@ -213,9 +213,9 @@ void InsetInclude::doDispatch(Cursor & cur, FuncRequest & cmd)
|
||||
|
||||
namespace {
|
||||
|
||||
string const masterFilename(Buffer const & buffer)
|
||||
FileName const masterFileName(Buffer const & buffer)
|
||||
{
|
||||
return buffer.masterBuffer()->absFileName();
|
||||
return buffer.masterBuffer()->fileName();
|
||||
}
|
||||
|
||||
|
||||
@ -416,7 +416,7 @@ int InsetInclude::latex(Buffer const & buffer, odocstream & os,
|
||||
docstring text = bformat(_("Included file `%1$s'\n"
|
||||
"has textclass `%2$s'\n"
|
||||
"while parent file has textclass `%3$s'."),
|
||||
makeDisplayPath(included_file.absFilename()),
|
||||
included_file.displayName(),
|
||||
from_utf8(tmp->params().getTextClass().name()),
|
||||
from_utf8(masterBuffer->params().getTextClass().name()));
|
||||
Alert::warning(_("Different textclasses"), text);
|
||||
@ -438,7 +438,7 @@ int InsetInclude::latex(Buffer const & buffer, odocstream & os,
|
||||
docstring text = bformat(_("Included file `%1$s'\n"
|
||||
"uses module `%2$s'\n"
|
||||
"which is not used in parent file."),
|
||||
makeDisplayPath(included_file.absFilename()), from_utf8(module));
|
||||
included_file.displayName(), from_utf8(module));
|
||||
Alert::warning(_("Module not found"), text);
|
||||
}
|
||||
}
|
||||
@ -454,7 +454,7 @@ int InsetInclude::latex(Buffer const & buffer, odocstream & os,
|
||||
Encoding const * const oldEnc = runparams.encoding;
|
||||
runparams.encoding = &tmp->params().encoding();
|
||||
tmp->makeLaTeXFile(writefile,
|
||||
onlyPath(masterFilename(buffer)),
|
||||
masterFileName(buffer).onlyPath(),
|
||||
runparams, false);
|
||||
runparams.encoding = oldEnc;
|
||||
} else {
|
||||
|
@ -116,6 +116,18 @@ bool FileName::isReadable() const
|
||||
}
|
||||
|
||||
|
||||
std::string FileName::onlyFileName() const
|
||||
{
|
||||
return support::onlyFilename(absFilename());
|
||||
}
|
||||
|
||||
|
||||
std::string FileName::onlyPath() const
|
||||
{
|
||||
return support::onlyPath(absFilename());
|
||||
}
|
||||
|
||||
|
||||
bool FileName::isFileReadable() const
|
||||
{
|
||||
QFileInfo const fi(toqstr(name_));
|
||||
@ -175,6 +187,12 @@ bool FileName::createDirectory(int permission) const
|
||||
}
|
||||
|
||||
|
||||
docstring FileName::displayName(int threshold) const
|
||||
{
|
||||
return makeDisplayPath(absFilename(), threshold);
|
||||
}
|
||||
|
||||
|
||||
string FileName::fileContents() const
|
||||
{
|
||||
if (exists()) {
|
||||
|
@ -12,6 +12,8 @@
|
||||
#ifndef FILENAME_H
|
||||
#define FILENAME_H
|
||||
|
||||
#include "strfwd.h"
|
||||
|
||||
#include <string>
|
||||
#include <ctime>
|
||||
|
||||
@ -98,6 +100,15 @@ public:
|
||||
/// \p mask must be in filesystem encoding
|
||||
static FileName tempName(FileName const & dir = FileName(),
|
||||
std::string const & mask = std::string());
|
||||
|
||||
/// filename without path
|
||||
std::string onlyFileName() const;
|
||||
/// path without file name
|
||||
std::string onlyPath() const;
|
||||
/// used for display in the Gui
|
||||
docstring displayName(int threshold = 1000) const;
|
||||
|
||||
|
||||
protected:
|
||||
/// The absolute file name.
|
||||
/// The encoding is currently unspecified, anything else than ASCII
|
||||
|
Loading…
Reference in New Issue
Block a user