]> git.lyx.org Git - lyx.git/blobdiff - src/support/os_win32.cpp
Complete the removal of the embedding stuff. Maybe. It's hard to be sure we got every...
[lyx.git] / src / support / os_win32.cpp
index cb84bb7cb95facb5c631b3d76113e07bbd5e56e8..b03cdb9ce61c50305426535f0bb78507b768cc47 100644 (file)
 
 #include "support/os.h"
 #include "support/os_win32.h"
+
 #include "support/debug.h"
+#include "support/FileName.h"
 #include "support/gettext.h"
 #include "support/filetools.h"
 #include "support/lstrings.h"
 #include "support/ExceptionMessage.h"
 
-#include <boost/assert.hpp>
+#include "support/assert.h"
 
 #include <cstdlib>
 #include <vector>
@@ -209,7 +211,7 @@ static string const get_long_path(string const & short_path)
                long_path.resize(result);
                result = GetLongPathName(short_path.c_str(),
                                         &long_path[0], long_path.size());
-               BOOST_ASSERT(result <= long_path.size());
+               LASSERT(result <= long_path.size(), /**/);
        }
 
        return (result == 0) ? short_path : to_utf8(from_filesystem8bit(&long_path[0]));
@@ -240,7 +242,8 @@ string latex_path(string const & p)
        // on windows_style_tex_paths_), but we use always forward slashes,
        // since it gets written into a .tex file.
 
-       if (!windows_style_tex_paths_ && is_absolute_path(p)) {
+       FileName path(p);
+       if (!windows_style_tex_paths_ && path.isAbsolute()) {
                string const drive = p.substr(0, 2);
                string const cygprefix = cygdrive + "/" + drive.substr(0, 1);
                string const cygpath = subst(subst(p, '\\', '/'), drive, cygprefix);
@@ -252,37 +255,6 @@ string latex_path(string const & p)
 }
 
 
-// (Claus H.) On Win32 both Unix and Win32/DOS pathnames are used.
-// Therefore an absolute path could be either a pathname starting
-// with a slash (Unix) or a pathname starting with a drive letter
-// followed by a colon. Because a colon is not valid in pathes in Unix
-// and at another location in Win32 testing just for the existance
-// of the colon in the 2nd position seems to be enough!
-// FIXME: Port to FileName!
-bool is_absolute_path(string const & p)
-{
-       if (p.empty())
-               return false;
-
-       if (p[0] == '/')
-               // Unix style.
-               return true;
-
-       if (p.length() <= 1)
-               return false;
-
-       if (p[1] == ':')
-               // 'X:\' style.
-               return true;
-
-       if (p[0] == '\\' && p[1] == '\\')
-               // Network folder style: '\\server\share'
-               return true;
-
-       return false;
-}
-
-
 // returns a string suitable to be passed to popen when
 // reading a pipe
 char const * popen_read_mode()
@@ -357,7 +329,7 @@ string const GetFolderPath::operator()(folder_id _id) const
                id = CSIDL_APPDATA;
                break;
        default:
-               BOOST_ASSERT(false);
+               LASSERT(false, /**/);
        }
        HRESULT const result = (folder_path_func_)(0, id, 0,
                                                   SHGFP_TYPE_CURRENT,