From: Angus Leeming Date: Tue, 1 Feb 2005 16:41:24 +0000 (+0000) Subject: Some boost::filesystem fixes. X-Git-Tag: 1.6.10~14588 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=807a279bc43535de4f71ce0123c633a6c62e5041;p=features.git Some boost::filesystem fixes. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9564 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/ChangeLog b/src/ChangeLog index b18132a27e..b111528238 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2005-02-01 Angus Leeming + + * lyx_main.C (init, queryUserLyXDir): use fs::exists() before + calling fs::is_directory(). + 2005-01-31 Angus Leeming * lyx_main.C (priv_exec): specify explicitly the relative location diff --git a/src/frontends/xforms/ChangeLog b/src/frontends/xforms/ChangeLog index 92567e5023..ab900e5fd3 100644 --- a/src/frontends/xforms/ChangeLog +++ b/src/frontends/xforms/ChangeLog @@ -1,3 +1,8 @@ +2005-02-01 Angus Leeming + + * FormFiledialog.C (Reread): use fs::exists() before + calling fs::is_directory(). + 2005-01-31 Lars Gullik Bjonnes * xforms_helpers.C: rewrite to use boost.filesystem diff --git a/src/frontends/xforms/FormFiledialog.C b/src/frontends/xforms/FormFiledialog.C index dc796c56bf..5bbc9fc37c 100644 --- a/src/frontends/xforms/FormFiledialog.C +++ b/src/frontends/xforms/FormFiledialog.C @@ -184,7 +184,7 @@ void FileDialog::Private::Reread() if (!mask_.empty() && mask_[0] != '.' && fname[0] == '.') continue; - bool const isDir = fs::is_directory(*beg); + bool const isDir = fs::exists(*beg) && fs::is_directory(*beg); // filters files according to pattern and type typedef vector::const_iterator viterator; diff --git a/src/lyx_main.C b/src/lyx_main.C index fea5a59702..e356ffa7aa 100644 --- a/src/lyx_main.C +++ b/src/lyx_main.C @@ -484,7 +484,8 @@ void LyX::init(bool gui) if (reconfigure) reconfigureUserLyXDir(); - if (fs::is_directory(lyxrc.document_path)) + if (fs::exists(lyxrc.document_path) && + fs::is_directory(lyxrc.document_path)) package().document_dir() = lyxrc.document_path; package().temp_dir() = createLyXTmpDir(lyxrc.tempdir_path); @@ -612,7 +613,8 @@ bool LyX::queryUserLyXDir(bool explicit_userdir) bool reconfigure = false; // Does user directory exist? - if (fs::is_directory(package().user_support())) { + if (fs::exists(package().user_support()) && + fs::is_directory(package().user_support())) { first_start = false; string const configure_script = AddName(package().system_support(), "configure"); diff --git a/src/support/ChangeLog b/src/support/ChangeLog index 1649f11cbe..fd7759a8f9 100644 --- a/src/support/ChangeLog +++ b/src/support/ChangeLog @@ -1,3 +1,7 @@ +2005-02-01 Angus Leeming + + * fs_extras.C: #include + 2005-01-31 Angus Leeming * package.[Ch] (init_package, c-tor): define and use an enum to diff --git a/src/support/filetools.C b/src/support/filetools.C index bd28c05144..45cce5bb3a 100644 --- a/src/support/filetools.C +++ b/src/support/filetools.C @@ -106,7 +106,6 @@ string const MakeLatexName(string const & file) } -// Substitutes spaces with underscores in filename (and path) string const QuoteName(string const & name) { return (os::shell() == os::UNIX) ? @@ -307,8 +306,8 @@ string const LibScriptSearch(string const & command_in) string::size_type const pos1 = command.find(token_scriptpath); if (pos1 == string::npos) return command; - // Find the end of the "$$s/some_script" word within command. - // Assumes that the script name does not contain spaces. + // Find the end of the "$$s/some_subdir/some_script" word within + // command. Assumes that the script name does not contain spaces. string::size_type const start_script = pos1 + 4; string::size_type const pos2 = command.find(' ', start_script); string::size_type const size_script = pos2 == string::npos? diff --git a/src/support/fs_extras.C b/src/support/fs_extras.C index 5872134bb3..d7bd1b3ec2 100644 --- a/src/support/fs_extras.C +++ b/src/support/fs_extras.C @@ -22,6 +22,11 @@ # endif # endif +#if defined (BOOST_WINDOWS) +# define WIN32_LEAN_AND_MEAN +# include +#endif + namespace fs = boost::filesystem; namespace boost {