(canAutoOpenFile): correct comment
(autoOpenFile): ditto
* src/support/os_win32.C
(canAutoOpenFile): Remove unneeded test for dot
(autoOpenFile): whitespace
* src/support/os_cygwin.C
(canAutoOpenFile): Remove unneeded test for dot
(autoOpenFile): whitespace
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@13866
a592a061-630c-0410-9148-
cb99ea01b6c8
EDIT
};
-/** Check whether or not a file can be viewed by a default viewer
+/** Check whether or not a file can be opened by a default viewer or editor.
* \param extension (without leading .)
- * \mode can be opened in VIEW or EDIT mode
- * \returns whether or not the format can be viewed
+ * \param mode can be opened in VIEW or EDIT mode
+ * \returns whether or not the format can be opened according to \p mode
*/
-bool canAutoOpenFile(std::string const & ext, auto_open_mode const mode=VIEW);
+bool canAutoOpenFile(std::string const & ext, auto_open_mode const mode = VIEW);
-/** view a file, with given command and parameter.
- * \param filename
+/** View or edit a file with the default viewer or editor.
+ * \param filename file to open
* \param mode open in VIEW or EDIT mode
* \returns whether or not the file is viewed (or edited) successfully.
*/
-bool autoOpenFile(std::string const & filename, auto_open_mode const mode=VIEW);
+bool autoOpenFile(std::string const & filename, auto_open_mode const mode = VIEW);
} // namespace os
} // namespace support
{
if (ext.empty())
return false;
-
- string full_ext = ext;
- // if the extension is passed without leading dot
- if (full_ext[0] != '.')
- full_ext = "." + ext;
+
+ string const full_ext = "." + ext;
DWORD bufSize = MAX_PATH + 100;
TCHAR buf[MAX_PATH + 100];
string const win_path =
os::convert_path(filename, os::PathStyle(os::windows));
char const * action = (mode == VIEW) ? "open" : "edit";
- return reinterpret_cast<int>(ShellExecute(NULL, action,
+ return reinterpret_cast<int>(ShellExecute(NULL, action,
win_path.c_str(), NULL, NULL, 1)) > 32;
}
{
if (ext.empty())
return false;
-
- string full_ext = ext;
- // if the extension is passed without leading dot
- if (full_ext[0] != '.')
- full_ext = "." + ext;
+
+ string const full_ext = "." + ext;
DWORD bufSize = MAX_PATH + 100;
TCHAR buf[MAX_PATH + 100];
// reference: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc
// /platform/shell/reference/functions/shellexecute.asp
char const * action = (mode == VIEW) ? "open" : "edit";
- return reinterpret_cast<int>(ShellExecute(NULL, action,
+ return reinterpret_cast<int>(ShellExecute(NULL, action,
filename.c_str(), NULL, NULL, 1)) > 32;
}