\membersection{::wxMkdir}
-\func{bool}{wxMkdir}{\param{const wxString\& }{dir}}
+\func{bool}{wxMkdir}{\param{const wxString\& }{dir}, \param{int }{perm = 0777}}
Makes the directory {\it dir}, returning TRUE if successful.
+{\it perm} is the access mask for the directory for the systems on which it is
+supported (Unix) and doesn't have effect for the other ones.
+
\membersection{::wxRemoveFile}
\func{bool}{wxRemoveFile}{\param{const wxString\& }{file}}
WXDLLEXPORT bool wxSetWorkingDirectory(const wxString& d);
// Make directory
-WXDLLEXPORT bool wxMkdir(const wxString& dir);
+WXDLLEXPORT bool wxMkdir(const wxString& dir, int perm = 0777);
// Remove directory. Flags reserved for future use.
WXDLLEXPORT bool wxRmdir(const wxString& dir, int flags = 0);
return (flag == 0) ;
}
-bool wxMkdir(const wxString& dir)
+bool wxMkdir(const wxString& dir, int perm)
{
-#if defined(__WXSTUBS__)
- return FALSE;
-#elif defined(__VMS__)
- return FALSE;
-#elif defined( __WXMAC__ )
- strcpy( gwxMacFileName , dir ) ;
- wxUnix2MacFilename( gwxMacFileName ) ;
- return (mkdir(gwxMacFileName , 0 ) == 0);
-#elif (defined(__GNUWIN32__) && !defined(__MINGW32__)) || !defined(__WXMSW__)
- return (mkdir (WXSTRINGCAST dir, S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH) == 0);
+#if defined( __WXMAC__ )
+ strcpy( gwxMacFileName , dir ) ;
+ wxUnix2MacFilename( gwxMacFileName ) ;
+ const char *dirname = gwxMacFileName;
#else
- return (mkdir(WXSTRINGCAST dir) == 0);
+ const char *dirname = dir.c_str();
#endif
+
+ if ( mkdir(dirname, perm) != 0 )
+ {
+ wxLogSysError(_("Directory '%s' couldn't be created"), dirname);
+
+ return FALSE;
+ }
+
+ return TRUE;
}
bool wxRmdir(const wxString& dir, int WXUNUSED(flags))