Georg Baum wrote:
> Peter Kümmel wrote:
>
>> msvc only supports S_IWRITE/READ, seems it is better to disable it.
>> Are there reasons not to disable it on Windows?
>
> Since we basically want to make files and directories readonly you could
> also map the mode arguments to S_IWRITE/READ. The same holds for directory
> creation.
>
> We should also replace the passing of mode arguments as unsigned int with
> something more expressive in the future.
>
>
> Georg
>
>
Is this mapping OK?
Index: support/copy.C
===================================================================
--- support/copy.C (revision 15915)
+++ support/copy.C (working copy)
@@ -33,10 +33,22 @@
using std::ios;
using std::string;
+//FIXME: We should also replace the passing of mode arguments as unsigned int
with
+// something more expressive in the future. (Georg)
bool lyx::support::chmod(string const & file, unsigned long int mode)
{
#ifdef HAVE_CHMOD
+#ifdef _MSC_VER
+ if (mode == 400 || mode == 040 || mode ==004)
+ mode = _S_IREAD;
+ else if (mode == 200 || mode == 020 || mode ==002)
+ mode = _S_IWRITE;
+ else if (mode == 600 || mode == 704)
+ mode = _S_IREAD | _S_IWRITE;
+ else
+ return false;
+#endif
if (::chmod(file.c_str(), mode_t(mode)) != 0)
return false;
--
Peter Kümmel