// Purpose: interface of wxPathList and file functions
// Author: wxWidgets team
// RCS-ID: $Id$
-// Licence: wxWindows license
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
/**
@class wxPathList
- @wxheader{filefn.h}
The path list is a convenient way of storing a number of directories, and
when presented with a filename without a directory, searching for an
class wxPathList : public wxArrayString
{
public:
+ /**
+ Standard constructor.
+ */
wxPathList();
/**
// Global functions/macros
// ============================================================================
-/** @ingroup group_funcmacro_file */
+/** @addtogroup group_funcmacro_file */
//@{
+/**
+ A special return value of many wxWidgets classes to indicate that
+ an invalid offset was given.
+*/
+const int wxInvalidOffset = -1;
+
+/**
+ The type used to store and provide byte offsets or byte sizes for files or streams.
+
+ It is type-defined as @c off_t on POSIX platforms
+ (see http://www.gnu.org/software/libc/manual/html_node/File-Position-Primitive.html)
+ or to @c wxLongLong_t on Windows when @c wxHAS_HUGE_FILES is defined.
+*/
+typedef off_t wxFileOffset;
+
/**
Under Unix this macro changes the current process umask to the given value,
unless it is equal to -1 in which case nothing is done, and restores it to
@header{wx/filefn.h}
*/
-#define wxCHANGE_UMASK(int mask)
+#define wxCHANGE_UMASK(mask)
/**
This function returns the total number of bytes and number of free bytes on
Converts a DOS to a Unix filename by replacing backslashes with forward
slashes.
+ @deprecated
+ Construct a wxFileName with wxPATH_DOS and then use
+ wxFileName::GetFullPath(wxPATH_UNIX) instead.
+
@header{wx/filefn.h}
*/
void wxDos2UnixFilename(wxChar* s);
/**
- @warning This function is deprecated, use wxFileName instead.
-
Converts a Unix to a DOS filename by replacing forward slashes with
backslashes.
+ @deprecated
+ Construct a wxFileName with wxPATH_UNIX and then use
+ wxFileName::GetFullPath(wxPATH_DOS) instead.
+
@header{wx/filefn.h}
*/
void wxUnix2DosFilename(wxChar* s);
bool wxDirExists(const wxString& dirname);
/**
- @warning This function is obsolete, please use wxFileName::SplitPath()
- instead.
+ @deprecated
+ This function is obsolete, please use wxFileName::SplitPath() instead.
This function splits a full file name into components: the path (including
possible disk/drive specification under Windows), the base name, and the
/**
Renames @a file1 to @e file2, returning @true if successful.
- If @a overwrite parameter is @true (default), the destination file is
- overwritten if it exists, but if @a overwrite is @false, the functions
- fails in this case.
+ If @a file2 is a directory, @a file1 is moved into it (@a overwrite is
+ ignored in this case). Otherwise, if @a file2 is an existing file, it is
+ overwritten if @a overwrite is @true (default) and the function fails if @a
+ overwrite is @false.
@header{wx/filefn.h}
*/
bool dot_special);
/**
- @warning This function is deprecated, use wxGetCwd() instead.
+ @deprecated This function is deprecated, use wxGetCwd() instead.
Copies the current working directory into the buffer if supplied, or copies
the working directory into new storage (which you must delete yourself) if
*/
bool wxRemoveFile(const wxString& file);
+/**
+ File permission bit names.
+
+ We define these constants in wxWidgets 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 with "wx" prefix.
+ //@{
+ 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)
+};
+
/**
Makes the directory @a dir, returning @true if successful.
@header{wx/filefn.h}
*/
-bool wxMkdir(const wxString& dir, int perm = 0777);
+bool wxMkdir(const wxString& dir, int perm = wxS_DIR_DEFAULT);
/**
Removes the directory @a dir, returning @true if successful. Does not work
//@}
-/** @ingroup group_funcmacro_file */
+/** @addtogroup group_funcmacro_file */
//@{
/**
Returns the type of an open file. Possible return values are enumerations
wxFileKind wxGetFileKind(FILE* fp);
//@}
-/** @ingroup group_funcmacro_file */
+/** @addtogroup group_funcmacro_file */
//@{
/**
- @warning This function is obsolete, please use wxFileName::SplitPath()
- instead.
+ @deprecated
+ This function is obsolete, please use wxFileName::SplitPath() instead.
Returns the filename for a full path. The second form returns a pointer to
temporary storage that should not be deallocated.
char* wxFileNameFromPath(char* path);
//@}
-/** @ingroup group_funcmacro_file */
+/** @addtogroup group_funcmacro_file */
//@{
/**
- @warning This function is obsolete, please use
- wxFileName::CreateTempFileName() instead.
+ @deprecated
+ This function is obsolete, please use wxFileName::CreateTempFileName() instead.
@header{wx/filefn.h}
*/