+2005-03-27 Georg Baum <Georg.Baum@post.rwth-aachen.de>
+
+ * tex2lyx.C (read_syntaxfile): Don't use racy test with IsFileReadable
+ * tex2lyx.C (tex2lyx): ditto, and don't use fs::is_writable (it
+ returns false if the file does not exist on solaris)
+
2005-03-18 Georg Baum <Georg.Baum@post.rwth-aachen.de>
* text.C (parse_text): Fix \start_of_appendix output
*/
void read_syntaxfile(string const & file_name)
{
- if (!IsFileReadable(file_name)) {
+ ifstream is(file_name.c_str());
+ if (!is.good()) {
cerr << "Could not open syntax file \"" << file_name
<< "\" for reading." << endl;
exit(2);
}
- ifstream is(file_name.c_str());
// We can use our TeX parser, since the syntax of the layout file is
// modeled after TeX.
// Unknown tokens are just silently ignored, this helps us to skip some
bool tex2lyx(string const &infilename, string const &outfilename)
{
- if (!(IsFileReadable(infilename) && fs::is_writable(outfilename))) {
+ ifstream is(infilename.c_str());
+ if (!is.good()) {
+ cerr << "Could not open file \"" << infilename
+ << "\" for reading." << endl;
return false;
}
if (!overwrite_files && IsFileReadable(outfilename)) {
cerr << "Not overwriting existing file " << outfilename << "\n";
return false;
}
- ifstream is(infilename.c_str());
ofstream os(outfilename.c_str());
#ifdef FILEDEBUG
cerr << "File: " << infilename << "\n";
if (!syntaxfile.empty())
read_syntaxfile(syntaxfile);
- if (!IsFileReadable(argv[1])) {
+ ifstream is(argv[1]);
+ if (!is.good()) {
cerr << "Could not open input file \"" << argv[1]
<< "\" for reading." << endl;
return 2;
else
masterFilePath = lyx::support::getcwd();
- ifstream is(argv[1]);
tex2lyx(is, cout);
return 0;