mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-29 21:05:12 +00:00
Asgers Win32 changes to fs_extras
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9561 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
3f74d3dc9b
commit
b246ba02fd
@ -1,3 +1,7 @@
|
|||||||
|
2005-01-31 Lars Gullik Bjonnes <larsbj@gullik.net>
|
||||||
|
|
||||||
|
* fs_extras.C: add changes from Asgers Win32 patch.
|
||||||
|
|
||||||
2005-01-31 Asger Ottar Alstrup <aalstrup@laerdal.dk>
|
2005-01-31 Asger Ottar Alstrup <aalstrup@laerdal.dk>
|
||||||
|
|
||||||
* chdir.C (chdir):
|
* chdir.C (chdir):
|
||||||
@ -9,12 +13,12 @@
|
|||||||
|
|
||||||
2005-01-31 Lars Gullik Bjonnes <larsbj@gullik.net>
|
2005-01-31 Lars Gullik Bjonnes <larsbj@gullik.net>
|
||||||
|
|
||||||
* Makefile.am (libsupport_la_SOURCES): remove rmdir.C
|
* Makefile.am (libsupport_la_SOURCES): remove rmdir.C
|
||||||
|
|
||||||
* rmdir.C: delete file
|
* rmdir.C: delete file
|
||||||
|
|
||||||
* lyxlib.h: remove rmdir decl
|
* lyxlib.h: remove rmdir decl
|
||||||
|
|
||||||
2005-01-31 Lars Gullik Bjonnes <larsbj@gullik.net>
|
2005-01-31 Lars Gullik Bjonnes <larsbj@gullik.net>
|
||||||
|
|
||||||
* .cvsignore: add package.C
|
* .cvsignore: add package.C
|
||||||
|
@ -32,6 +32,11 @@ bool is_readable(path const & ph)
|
|||||||
#ifdef BOOST_POSIX
|
#ifdef BOOST_POSIX
|
||||||
return ::access(ph.string().c_str(), R_OK) == 0;
|
return ::access(ph.string().c_str(), R_OK) == 0;
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef BOOST_WINDOWS
|
||||||
|
DWORD const attr = ::GetFileAttributes(ph.string().c_str());
|
||||||
|
return attr != INVALID_FILE_ATTRIBUTES &&
|
||||||
|
(attr & FILE_ATTRIBUTE_DIRECTORY) != FILE_ATTRIBUTE_DIRECTORY;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -40,6 +45,16 @@ bool is_writable(path const & ph)
|
|||||||
#ifdef BOOST_POSIX
|
#ifdef BOOST_POSIX
|
||||||
return ::access(ph.string().c_str(), W_OK) == 0;
|
return ::access(ph.string().c_str(), W_OK) == 0;
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef BOOST_WINDOWS
|
||||||
|
DWORD const attr = ::GetFileAttributes(ph.string().c_str());
|
||||||
|
if (attr != INVALID_FILE_ATTRIBUTES &&
|
||||||
|
(attr & FILE_ATTRIBUTE_READONLY) != 0) {
|
||||||
|
// Read-only - no write access
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return attr != INVALID_FILE_ATTRIBUTES &&
|
||||||
|
(attr & FILE_ATTRIBUTE_DIRECTORY) != FILE_ATTRIBUTE_DIRECTORY;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -48,6 +63,11 @@ bool is_readonly(path const & ph)
|
|||||||
#ifdef BOOST_POSIX
|
#ifdef BOOST_POSIX
|
||||||
return is_readable(ph) && !is_writable(ph);
|
return is_readable(ph) && !is_writable(ph);
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef BOOST_WINDOWS
|
||||||
|
DWORD const attr = ::GetFileAttributes(ph.string().c_str());
|
||||||
|
return (attr != INVALID_FILE_ATTRIBUTES
|
||||||
|
&& (attr & FILE_ATTRIBUTE_READONLY));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -116,8 +136,16 @@ void copy_file(path const & source, path const & target, bool noclobber)
|
|||||||
source, target,
|
source, target,
|
||||||
fs::detail::system_error_code()));
|
fs::detail::system_error_code()));
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef BOOST_WINDOWS
|
||||||
|
if (::CopyFile(source.string().c_str(), target.string().c_str(), !noclobber) == 0) {
|
||||||
|
boost::throw_exception(
|
||||||
|
filesystem_error(
|
||||||
|
"boost::filesystem::copy_file",
|
||||||
|
source, target,
|
||||||
|
fs::detail::system_error_code()));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -662,7 +662,7 @@ bool check_env_var_dir(string const & dir,
|
|||||||
// translation.
|
// translation.
|
||||||
string const fmt =
|
string const fmt =
|
||||||
_("Invalid %1$s environment variable.\n%2$s is not a directory.");
|
_("Invalid %1$s environment variable.\n%2$s is not a directory.");
|
||||||
|
|
||||||
lyxerr << bformat(fmt, env_var, dir)
|
lyxerr << bformat(fmt, env_var, dir)
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user