#include "support/lstrings.h"
#include "support/os.h"
#include "support/Systemcall.h"
+#include "support/textutils.h"
#include <algorithm>
{
if (name_.empty())
return false;
- return isdigit(name_[name_.length() - 1]);
+ return isDigitASCII(name_[name_.length() - 1]);
}
it->setEditor(command);
}
-bool Formats::viewURL(string const &url){
- Format const * format = getFormat("html");
- string command = libScriptSearch(format->viewer());
-
- if (!contains(command, token_from_format))
- command += ' ' + token_from_format;
- command = subst(command, token_from_format, quoteName(url));
-
- LYXERR(Debug::FILES, "Executing command: " << command);
- //buffer.message(_("Executing command: ") + from_utf8(command));
-
- Systemcall one;
- int const res = one.startscript(Systemcall::DontWait, command);
-
- if (res) {
- Alert::error(_("Cannot view URL"),
- bformat(_("An error occurred whilst running %1$s"),
- makeDisplayPath(command, 50)));
- return false;
- }
- return true;
-}
bool Formats::view(Buffer const & buffer, FileName const & filename,
string const & format_name) const
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;
}
prettyName(format_name)));
return false;
}
-
+
// editor is 'auto'
if (format->editor() == "auto") {
if (os::autoOpenFile(filename.absFileName(), os::EDIT))
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;
}