]> git.lyx.org Git - lyx.git/blobdiff - src/support/filetools.C
Fix the line-delete-forward bug?
[lyx.git] / src / support / filetools.C
index 9f1f1061a663ea97ff67ad1bb623d0a926f82032..33b0d1a70ce50859b90d76ee7a9cdfa6341649c8 100644 (file)
@@ -19,8 +19,6 @@
 #include <cctype>
 
 #include <utility>
-using std::make_pair;
-using std::pair;
 
 #ifdef __GNUG__
 #pragma implementation "filetools.h"
@@ -52,6 +50,10 @@ using std::pair;
 # endif
 #endif
 
+using std::make_pair;
+using std::pair;
+using std::endl;
+
 extern string system_lyxdir;
 extern string build_lyxdir;
 extern string user_lyxdir;
@@ -64,12 +66,6 @@ bool IsLyXFilename(string const & filename)
 }
 
 
-bool IsSGMLFilename(string const & filename)
-{
-       return contains(filename, ".sgml");
-}
-
-
 // Substitutes spaces with underscores in filename (and path)
 string MakeLatexName(string const & file)
 {
@@ -95,9 +91,7 @@ string MakeLatexName(string const & file)
 // Substitutes spaces with underscores in filename (and path)
 string QuoteName(string const & name)
 {
-#ifdef WITH_WARNINGS
-#warning Add proper emx support here!
-#endif
+       // CHECK Add proper emx support here!
 #ifndef __EMX__
        return '\'' + name + '\'';
 #else
@@ -309,9 +303,7 @@ string GetEnvPath(string const & name)
 
 bool PutEnv(string const & envstr)
 {
-#ifdef WITH_WARNINGS
-#warning Look at and fix this.
-#endif
+       // CHECK Look at and fix this.
         // f.ex. what about error checking?
 #if HAVE_PUTENV
         // this leaks, but what can we do about it?
@@ -756,7 +748,7 @@ string ReplaceEnvironmentPath(string const & path)
                if (!regexMatch(copy1, RegExp)) {
                        // No EndChar inside. So we are finished
                        result1 += CompareString + result0;
-                       result0.clear();
+                       result0.erase();
                        continue;
                }
 
@@ -900,8 +892,7 @@ string AddPath(string const & path, string const & path_2)
  Strips path off if no_path == true.
  If no extension on oldname, just appends.
  */
-string ChangeExtension(string const & oldname, string const & extension, 
-                       bool no_path) 
+string ChangeExtension(string const & oldname, string const & extension)
 {
        string::size_type last_slash = oldname.rfind('/');
        string::size_type last_dot = oldname.rfind('.');
@@ -914,14 +905,8 @@ string ChangeExtension(string const & oldname, string const & extension,
                ext= '.' + extension;
        else
                ext = extension;
-       string ret_str;
-       if (no_path && last_slash != string::npos) {
-               ++last_slash; // step it
-               ret_str = oldname.substr(last_slash,
-                                        last_dot - last_slash) + ext;
-       } else
-               ret_str = oldname.substr(0, last_dot) + ext;
-       return CleanupPath(ret_str);
+
+       return CleanupPath(oldname.substr(0, last_dot) + ext);
 }
 
 
@@ -989,7 +974,8 @@ bool LyXReadLink(string const & File, string & Link)
 
 
 typedef pair<int, string> cmdret;
-static cmdret do_popen(string const & cmd)
+static
+cmdret do_popen(string const & cmd)
 {
        // One question is if we should use popen or
        // create our own popen based on fork, exec, pipe