]> cygwin.com Git - cygwin-apps/setup.git/blobdiff - io_stream_file.cc
2002-07-15 Robert Collins <rbtcollins@hotmail.com>
[cygwin-apps/setup.git] / io_stream_file.cc
index ad4359cd6b17a75e295189a24936ee0610953b36..c234d7f46a6fd81a5e0ef03bedbe893036c82226 100644 (file)
@@ -21,18 +21,25 @@ static const char *cvsid =
 #if defined(WIN32) && !defined (_CYGWIN_)
 #include "win32.h"
 #include "port.h"
-#include "mkdir.h"
 #include "mklink2.h"
 #endif
 
+#include "mkdir.h"
+  
+  
 #include <stdio.h>
 #include <stdlib.h>
 #include <errno.h>
 #include <unistd.h>
-
+#if HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+#include <stdexcept>
+  
 #include "io_stream_file.h"
 #include "IOStreamProvider.h"
 
+
 /* completely private iostream registration class */
 class FileProvider : public IOStreamProvider
 {
@@ -49,7 +56,9 @@ public:
   int move (String const &a,String const &b) const
     {return io_stream_file::move (a, b);}
   int mkdir_p (enum path_type_t isadir, String const &path) const
-    {return ::mkdir_p (isadir == PATH_TO_DIR ? 1 : 0, path.cstr_oneuse());}
+    {
+      return ::mkdir_p (isadir == PATH_TO_DIR ? 1 : 0, path.cstr_oneuse());
+    }
 protected:
   FileProvider() // no creating this
     {
@@ -119,6 +128,7 @@ io_stream_file::remove (String const &path)
       MoveFile (path.cstr_oneuse(), tmp);
       delete[] tmp;
     }
+  SetFileAttributes (path.cstr_oneuse(), w & ~FILE_ATTRIBUTE_READONLY);
   return !DeleteFileA (path.cstr_oneuse());
 #else
   // FIXME: try rmdir if unlink fails - remove the dir
This page took 0.026208 seconds and 5 git commands to generate.