]> git.lyx.org Git - lyx.git/blobdiff - src/support/Package.cpp
Now that exceptions are allowed, handle gracefully the case where a Buffer temp direc...
[lyx.git] / src / support / Package.cpp
index b526df6d4d15399e1fec67233829056dd968ff7d..774bcc043de3dc3cdabb785e60c6ea344537b183 100644 (file)
@@ -38,7 +38,7 @@
 # include <CoreServices/CoreServices.h> // FSFindFolder, FSRefMakePath
 #endif
 
-using std::string;
+using namespace std;
 
 namespace lyx {
 namespace support {
@@ -379,8 +379,9 @@ FileName const abs_path_from_command_line(string const & command_line)
        if (command_line.empty())
                return FileName();
 
-       string const path = fix_dir_name(command_line);
-       return os::is_absolute_path(path) ? FileName(path) : makeAbsPath(path);
+       string const str_path = fix_dir_name(command_line);
+       FileName path(str_path);
+       return path.isAbsolute() ? path : makeAbsPath(str_path);
 }
 
 
@@ -397,8 +398,9 @@ FileName const get_binary_path(string const & exe)
 #else
        string const exe_path = os::internal_path(exe);
 #endif
-       if (os::is_absolute_path(exe_path))
-               return FileName(exe_path);
+       FileName exepath(exe_path);
+       if (exepath.isAbsolute())
+               return exepath;
 
        // Two possibilities present themselves.
        // 1. The binary is relative to the CWD.
@@ -412,9 +414,9 @@ FileName const get_binary_path(string const & exe)
        if (exe_name != exe_path)
                return FileName();
 
-       std::vector<string> const path = getEnvPath("PATH");
-       std::vector<string>::const_iterator it = path.begin();
-       std::vector<string>::const_iterator const end = path.end();
+       vector<string> const path = getEnvPath("PATH");
+       vector<string>::const_iterator it = path.begin();
+       vector<string>::const_iterator const end = path.end();
        for (; it != end; ++it) {
                // This will do nothing if *it is already absolute.
                string const exe_dir = makeAbsPath(*it).absFilename();
@@ -455,7 +457,7 @@ get_system_support_dir(FileName const & abs_binary,
 
        // searched_dirs is used for diagnostic purposes only in the case
        // that "chkconfig.ltx" is not found.
-       std::list<FileName> searched_dirs;
+       list<FileName> searched_dirs;
 
        // 1. Use the -sysdir command line parameter.
        FileName path = abs_path_from_command_line(command_line_system_support_dir);
@@ -545,7 +547,7 @@ get_system_support_dir(FileName const & abs_binary,
        // Everything has failed :-(
        // So inform the user and exit.
        string searched_dirs_str;
-       typedef std::list<FileName>::const_iterator iterator;
+       typedef list<FileName>::const_iterator iterator;
        iterator const begin = searched_dirs.begin();
        iterator const end = searched_dirs.end();
        for (iterator it = begin; it != end; ++it) {