X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f030eeed1e1d31dd5568b07e5a3aa56e8514fb14..28756ab9c52aba43c99409cea3a9faedb1bccf6a:/include/wx/filefn.h diff --git a/include/wx/filefn.h b/include/wx/filefn.h index 1699933e4f..2f05143559 100644 --- a/include/wx/filefn.h +++ b/include/wx/filefn.h @@ -134,6 +134,51 @@ enum wxFileKind wxFILE_KIND_PIPE // a pipe }; +// we redefine these constants here because S_IREAD &c are _not_ standard +// however, we do assume that the values correspond to the Unix umask bits +enum wxPosixPermissions +{ + // standard Posix names for these permission flags: + wxS_IRUSR = 00400, + wxS_IWUSR = 00200, + wxS_IXUSR = 00100, + + wxS_IRGRP = 00040, + wxS_IWGRP = 00020, + wxS_IXGRP = 00010, + + wxS_IROTH = 00004, + wxS_IWOTH = 00002, + wxS_IXOTH = 00001, + + // longer but more readable synonyms for the constants above: + wxPOSIX_USER_READ = wxS_IRUSR, + wxPOSIX_USER_WRITE = wxS_IWUSR, + wxPOSIX_USER_EXECUTE = wxS_IXUSR, + + wxPOSIX_GROUP_READ = wxS_IRGRP, + wxPOSIX_GROUP_WRITE = wxS_IWGRP, + wxPOSIX_GROUP_EXECUTE = wxS_IXGRP, + + wxPOSIX_OTHERS_READ = wxS_IROTH, + wxPOSIX_OTHERS_WRITE = wxS_IWOTH, + wxPOSIX_OTHERS_EXECUTE = wxS_IXOTH, + + // default mode for the new files: allow reading/writing them to everybody but + // the effective file mode will be set after anding this value with umask and + // so won't include wxS_IW{GRP,OTH} for the default 022 umask value + wxS_DEFAULT = (wxPOSIX_USER_READ | wxPOSIX_USER_WRITE | \ + wxPOSIX_GROUP_READ | wxPOSIX_GROUP_WRITE | \ + wxPOSIX_OTHERS_READ | wxPOSIX_OTHERS_WRITE), + + // default mode for the new directories (see wxFileName::Mkdir): allow + // reading/writing/executing them to everybody, but just like wxS_DEFAULT + // the effective directory mode will be set after anding this value with umask + wxS_DIR_DEFAULT = (wxPOSIX_USER_READ | wxPOSIX_USER_WRITE | wxPOSIX_USER_EXECUTE | \ + wxPOSIX_GROUP_READ | wxPOSIX_GROUP_WRITE | wxPOSIX_GROUP_EXECUTE | \ + wxPOSIX_OTHERS_READ | wxPOSIX_OTHERS_WRITE | wxPOSIX_OTHERS_EXECUTE) +}; + // ---------------------------------------------------------------------------- // declare our versions of low level file functions: some compilers prepend // underscores to the usual names, some also have Unicode versions of them @@ -666,7 +711,7 @@ WXDLLIMPEXP_BASE wxString wxGetCwd(); WXDLLIMPEXP_BASE bool wxSetWorkingDirectory(const wxString& d); // Make directory -WXDLLIMPEXP_BASE bool wxMkdir(const wxString& dir, int perm = 0777); +WXDLLIMPEXP_BASE bool wxMkdir(const wxString& dir, int perm = wxS_DIR_DEFAULT); // Remove directory. Flags reserved for future use. WXDLLIMPEXP_BASE bool wxRmdir(const wxString& dir, int flags = 0);