#include <utility>
#include <fstream>
-#ifdef HAVE_SSTREAM
-#include <sstream>
-#else
-#include <strstream>
-#endif
+#include "Lsstream.h"
#ifdef __GNUG__
#pragma implementation "filetools.h"
FileInfo finfo(fname);
if (finfo.exist()) {
ifstream ifs(fname.c_str());
-#ifdef HAVE_SSTREAM
std::ostringstream ofs;
-#else
-#warning The rumour goes that this might leak, but who really cares?
- ostrstream ofs;
-#endif
if (ifs && ofs) {
ofs << ifs.rdbuf();
ifs.close();
-#ifdef HAVE_SSTREAM
return ofs.str().c_str();
-#else
- ofs << '\0';
- char const * tmp = ofs.str();
- string ret(tmp);
- delete[] tmp;
- return ret;
-#endif
}
}
lyxerr << "LyX was not able to read file '" << fname << "'" << endl;
return CleanupPath(oldname.substr(0, last_dot) + ext);
}
+
/// Return the extension of the file (not including the .)
-string GetExtension(string const & name)
+string const GetExtension(string const & name)
{
string::size_type last_slash = name.rfind('/');
string::size_type last_dot = name.rfind('.');
return string();
}
+
// Creates a nice compact path for displaying
string const
MakeDisplayPath (string const & path, unsigned int threshold)
return c.first != -1 ? strip(c.second, '\n') : string();
}
+
void removeAutosaveFile(string const & filename)
{
string a = OnlyPath(filename);