X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FFormat.cpp;h=050af1414f69ae0058849c9f26e35af9c68ca961;hb=66ca99798bff016b0a60cb10bd2124c5c228c8b6;hp=5605dbb5569b662c2439ba131ce335bade4eefc0;hpb=0e6b1220dee50b7b31de4af83ff1f5c669f54c3f;p=lyx.git diff --git a/src/Format.cpp b/src/Format.cpp index 5605dbb556..050af1414f 100644 --- a/src/Format.cpp +++ b/src/Format.cpp @@ -24,6 +24,9 @@ #include "support/lstrings.h" #include "support/os.h" #include "support/Systemcall.h" +#include "support/textutils.h" + +#include // FIXME: Q_WS_MACX is not available, it's in Qt #ifdef USE_MACOSX_PACKAGING @@ -100,7 +103,7 @@ bool Format::isChildFormat() const { if (name_.empty()) return false; - return isdigit(name_[name_.length() - 1]); + return isDigitASCII(name_[name_.length() - 1]); } @@ -134,7 +137,7 @@ string Formats::getFormatFromFile(FileName const & filename) const return format; // try to find a format from the file extension. - string const ext = getExtension(filename.absFilename()); + string const ext = getExtension(filename.absFileName()); if (!ext.empty()) { // this is ambigous if two formats have the same extension, // but better than nothing @@ -263,7 +266,7 @@ bool Formats::view(Buffer const & buffer, FileName const & filename, if (filename.empty() || !filename.exists()) { Alert::error(_("Cannot view file"), bformat(_("File does not exist: %1$s"), - from_utf8(filename.absFilename()))); + from_utf8(filename.absFileName()))); return false; } @@ -281,12 +284,12 @@ bool Formats::view(Buffer const & buffer, FileName const & filename, } // viewer is 'auto' if (format->viewer() == "auto") { - if (os::autoOpenFile(filename.absFilename(), os::VIEW)) + if (os::autoOpenFile(filename.absFileName(), os::VIEW)) return true; else { Alert::error(_("Cannot view file"), bformat(_("Auto-view file %1$s failed"), - from_utf8(filename.absFilename()))); + from_utf8(filename.absFileName()))); return false; } } @@ -316,14 +319,9 @@ bool Formats::view(Buffer const & buffer, FileName const & filename, buffer.message(_("Executing command: ") + from_utf8(command)); Systemcall one; - int const res = one.startscript(Systemcall::DontWait, command); + one.startscript(Systemcall::DontWait, command); - if (res) { - Alert::error(_("Cannot view file"), - bformat(_("An error occurred whilst running %1$s"), - makeDisplayPath(command, 50))); - return false; - } + // we can't report any sort of error, since we aren't waiting return true; } @@ -334,15 +332,15 @@ bool Formats::edit(Buffer const & buffer, FileName const & filename, if (filename.empty() || !filename.exists()) { Alert::error(_("Cannot edit file"), bformat(_("File does not exist: %1$s"), - from_utf8(filename.absFilename()))); + from_utf8(filename.absFileName()))); return false; } // LinkBack files look like PDF, but have the .linkback extension - string const ext = getExtension(filename.absFilename()); + string const ext = getExtension(filename.absFileName()); if (format_name == "pdf" && ext == "linkback") { #ifdef USE_MACOSX_PACKAGING - return editLinkBackFile(filename.absFilename().c_str()); + return editLinkBackFile(filename.absFileName().c_str()); #else Alert::error(_("Cannot edit file"), _("LinkBack files can only be edited on Apple Mac OSX.")); @@ -365,12 +363,12 @@ bool Formats::edit(Buffer const & buffer, FileName const & filename, // editor is 'auto' if (format->editor() == "auto") { - if (os::autoOpenFile(filename.absFilename(), os::EDIT)) + if (os::autoOpenFile(filename.absFileName(), os::EDIT)) return true; else { Alert::error(_("Cannot edit file"), bformat(_("Auto-edit file %1$s failed"), - from_utf8(filename.absFilename()))); + from_utf8(filename.absFileName()))); return false; } } @@ -388,14 +386,9 @@ bool Formats::edit(Buffer const & buffer, FileName const & filename, buffer.message(_("Executing command: ") + from_utf8(command)); Systemcall one; - int const res = one.startscript(Systemcall::DontWait, command); + one.startscript(Systemcall::DontWait, command); - if (res) { - Alert::error(_("Cannot edit file"), - bformat(_("An error occurred whilst running %1$s"), - makeDisplayPath(command, 50))); - return false; - } + // we can't report any sort of error, since we aren't waiting return true; }