]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/filename.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxFileName - encapsulates ice cream
4 // Author: Robert Roebling
8 // Copyright: (c) 2000 Robert Roebling
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_FILENAME_H_
13 #define _WX_FILENAME_H_
16 #pragma interface "filename.h"
20 #include "wx/string.h"
23 // ridiculously enough, this will replace DirExists with wxDirExists etc
24 #include "wx/filefn.h"
33 wxPATH_BEOS
= wxPATH_UNIX
,
34 wxPATH_WIN
= wxPATH_DOS
,
35 wxPATH_OS2
= wxPATH_DOS
39 class WXDLLEXPORT wxFileName
42 // constructors and assignment
45 wxFileName( const wxFileName
&filepath
);
46 wxFileName( const wxString
&path
, bool dir_only
= FALSE
, wxPathFormat format
= wxPATH_NATIVE
)
47 { Assign( path
, dir_only
, format
); }
48 void Assign( const wxString
&path
, bool dir_only
= FALSE
, wxPathFormat format
= wxPATH_NATIVE
);
49 void Assign( const wxFileName
&filepath
);
53 static bool FileExists( const wxString
&file
);
56 static bool DirExists( const wxString
&dir
);
59 static wxString
GetCwd();
62 static bool SetCwd( const wxString
&cwd
);
65 static wxString
GetHomeDir();
67 void AssignTempFileName( const wxString
&prefix
);
69 bool Mkdir( int perm
= 0777 );
70 static bool Mkdir( const wxString
&dir
, int perm
= 0777 );
73 static bool Rmdir( const wxString
&dir
);
75 // Remove . and .. (under Unix ~ as well)
76 bool Normalize( const wxString
&cwd
= wxEmptyString
, const wxString
&home
= wxEmptyString
);
79 bool SameAs( const wxFileName
&filepath
, bool upper_case
= TRUE
);
82 bool IsCaseSensitive( wxPathFormat format
= wxPATH_NATIVE
);
83 bool IsRelative( wxPathFormat format
= wxPATH_NATIVE
);
84 bool IsAbsolute( wxPathFormat format
= wxPATH_NATIVE
);
85 bool IsWild( wxPathFormat format
= wxPATH_NATIVE
);
88 void AppendDir( const wxString
&dir
);
89 void PrependDir( const wxString
&dir
);
90 void InsertDir( int before
, const wxString
&dir
);
91 void RemoveDir( int pos
);
92 size_t GetDirCount() { return m_dirs
.GetCount(); }
95 void SetExt( const wxString
&ext
) { m_ext
= ext
; }
96 wxString
GetExt() const { return m_ext
; }
97 bool HasExt() const { return !m_ext
.IsEmpty(); }
99 void SetName( const wxString
&name
) { m_name
= name
; }
100 wxString
GetName() const { return m_name
; }
101 bool HasName() const { return !m_name
.IsEmpty(); }
104 void SetFullName( const wxString name
, wxPathFormat format
= wxPATH_NATIVE
);
105 wxString
GetFullName();
107 const wxArrayString
&GetDirs() const { return m_dirs
; }
109 // Construct path only
110 wxString
GetPath( bool add_separator
= FALSE
, wxPathFormat format
= wxPATH_NATIVE
) const;
112 // Construct full path with name and ext
113 wxString
GetFullPath( wxPathFormat format
= wxPATH_NATIVE
) const;
116 static wxPathFormat
GetFormat( wxPathFormat format
= wxPATH_NATIVE
);
119 wxArrayString m_dirs
;
126 #endif // _WX_FFILENAME_H_