NodeClass.Empty();
wxString path = list.FindValidPath(filename);
- if (path.IsEmpty()) return;
+ if (path.empty()) return;
wxTextFile tf;
tf.Open(path);
}
}
- if (!nd.IsEmpty()) NodeClass = nd;
- if (!cht.IsEmpty()) ChildType = cht;
- if (!!tp) Type = tp;
+ if (!nd.empty()) NodeClass = nd;
+ if (!cht.empty()) ChildType = cht;
+ if (!tp.empty()) Type = tp;
if (icn != -1) Icon = icn;
Abstract = ab;
}
void NodesDb::LoadDir(const wxString& path)
{
- if (!wxDirExists(path)) return;
+ if (!wxPathExists(path)) return;
wxDir dir(path);
wxString filename;
\helpref{wxDDEInitialize}{wxddeinitialize}\\
\helpref{wxDROP\_ICON}{wxdropicon}\\
\helpref{wxDebugMsg}{wxdebugmsg}\\
-\helpref{wxDirExists}{functionwxdirexists}\\
\helpref{wxDirSelector}{wxdirselector}\\
\helpref{wxDisplayDepth}{wxdisplaydepth}\\
\helpref{wxDisplaySize}{wxdisplaysize}\\
\helpref{wxOnAssert}{wxonassert}\\
\helpref{wxOpenClipboard}{wxopenclipboard}\\
\helpref{wxParseCommonDialogsFilter}{wxparsecommondialogsfilter}\\
+\helpref{wxPathExists}{functionwxpathexists}\\
\helpref{wxPathOnly}{wxpathonly}\\
\helpref{wxPostDelete}{wxpostdelete}\\
\helpref{wxPostEvent}{wxpostevent}\\
\helpref{wxFileName}{wxfilename}
-\membersection{::wxDirExists}\label{functionwxdirexists}
-
-\func{bool}{wxDirExists}{\param{const wxString\& }{dirname}}
-
-Returns true if the directory exists.
-
-
\membersection{::wxDos2UnixFilename}\label{wxdos2unixfilename}
\func{void}{wxDos2UnixFilename}{\param{wxChar *}{s}}
or drive name at the beginning.
+\membersection{::wxPathExists}\label{functionwxpathexists}
+
+\func{bool}{wxPathExists}{\param{const wxString\& }{dirname}}
+
+Returns true if the path exists.
+
+
\membersection{::wxPathOnly}\label{wxpathonly}
\func{wxString}{wxPathOnly}{\param{const wxString\& }{path}}
wxFileOffset wxSeek(int fd, wxFileOffset offset, int origin);
#define wxLSeek wxSeek
wxFileOffset wxTell(int fd);
-
+
// always Unicode under WinCE
#define wxMkDir _wmkdir
#define wxRmDir _wrmdir
WXDLLIMPEXP_BASE wxFileKind wxGetFileKind(FILE *fp);
// compatibility defines, don't use in new code
-#define wxDirExists wxPathExists
+#if WXWIN_COMPATIBILITY_2_4
+ #define wxDirExists wxPathExists
+#endif
// ----------------------------------------------------------------------------
// separators in file names
3. SameFileAs() function to compare inodes under Unix
*/
-// ridiculously enough, this will replace DirExists with wxDirExists etc
#include "wx/filefn.h"
#include "wx/datetime.h"
bool IsOk() const
{
// we're fine if we have the path or the name or if we're a root dir
- return m_dirs.size() != 0 || !m_name.IsEmpty() || !m_relative ||
+ return m_dirs.size() != 0 || !m_name.empty() || !m_relative ||
!m_ext.empty() || m_hasExt;
}
DWORD ret = ::GetFileAttributes(strPath);
return (ret != (DWORD)-1) && (ret & FILE_ATTRIBUTE_DIRECTORY);
+#elif defined(__OS2__)
+ return (::DosSetCurrentDir(WXSTRINGCAST strPath));
#else // !__WIN32__
wxStructStat st;
// This is important for the archive streams, which benefit greatly from
// being able to seek on a stream, but which will produce corrupt archives
// if they unknowingly seek on a non-seekable stream.
-//
+//
// wxFILE_KIND_DISK is a good catch all return value, since other values
// disable features of the archive streams. Some other value must be returned
// for a file type that appears seekable but isn't.
bool wxFileName::DirExists( const wxString &dir )
{
- return ::wxDirExists( dir );
+ return ::wxPathExists( dir );
}
// ----------------------------------------------------------------------------
if (!wxEndsWithPathSeparator(path))
path += wxFILE_SEP_PATH;
path += new_name;
- if (wxFileExists(path))
+ if (wxPathExists(path))
{
// try NewName0, NewName1 etc.
int i = 0;
path += wxFILE_SEP_PATH;
path += new_name;
i++;
- } while (wxFileExists(path));
+ } while (wxPathExists(path));
}
wxLogNull log;
void wxFileCtrl::GoToDir( const wxString &dir )
{
- if (!wxDirExists(dir)) return;
+ if (!wxPathExists(dir)) return;
m_dirName = dir;
UpdateFiles();
if (!IsTopMostDir(dir))
dir += wxFILE_SEP_PATH;
dir += filename;
- if (wxDirExists(dir)) return;
+ if (wxPathExists(dir)) return;
ignoreChanges = true;
m_text->SetValue( filename );
filename = dir;
}
- if (wxDirExists(filename))
+ if (wxPathExists(filename))
{
m_list->GoToDir( filename );
UpdateControls();
{
wxString newfile;
newfile << WXEXTHELP_SEPARATOR << wxGetLocale()->GetName();
- if(wxDirExists(newfile))
+ if(wxPathExists(newfile))
file = newfile;
else
{
const wxChar *cptr = wxGetLocale()->GetName().c_str();
while(*cptr && *cptr != wxT('_'))
newfile << *(cptr++);
- if(wxDirExists(newfile))
+ if(wxPathExists(newfile))
file = newfile;
}
}
#endif
- if(! wxDirExists(file))
+ if(! wxPathExists(file))
return false;
mapFile << file << WXEXTHELP_SEPARATOR << WXEXTHELP_MAPFILE;
dialog->SetPath(filename);
dialog->UpdateFromDialog();
-
+
wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK);
event.SetEventObject(dialog);
dialog->GetEventHandler()->ProcessEvent(event);
wxFileDialog *dialog)
{
wxapp_install_idle_handler();
-
+
if (response == GTK_RESPONSE_ACCEPT)
gtk_filedialog_ok_callback(w, dialog);
else if (response == GTK_RESPONSE_CANCEL)
else // "delete"
{
gtk_filedialog_cancel_callback(w, dialog);
- dialog->m_destroyed_by_delete = TRUE;
+ dialog->m_destroyed_by_delete = true;
}
}
#endif
#ifdef __WXGTK24__
if (!gtk_check_version(2,4,0))
{
- m_needParent = FALSE;
- m_destroyed_by_delete = FALSE;
+ m_needParent = false;
+ m_destroyed_by_delete = false;
if (!PreCreation(parent, pos, wxDefaultSize) ||
!CreateBase(parent, wxID_ANY, pos, wxDefaultSize, style,
GtkWindow* gtk_parent = NULL;
if (parent)
gtk_parent = GTK_WINDOW(parent->m_widget);
-
+
gchar* ok_btn_stock;
if ((style & wxSAVE) == wxSAVE)
{
NULL);
gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(m_widget), multiple);
-
+
gtk_signal_connect(GTK_OBJECT(m_widget),
- "response",
+ "response",
GTK_SIGNAL_FUNC(gtk_filedialog_response_callback),
(gpointer*)this);
-
+
m_path = m_dir;
if (!m_path.empty() && m_path.Last() != wxT('/'))
m_path += wxT('/');
m_path += m_fileName;
SetPath(m_path);
-
+
SetWildcard(wildCard);
SetFilterIndex(0);
}
return wxGenericFileDialog::Show( show );
}
-void wxFileDialog::GetFilenames(wxArrayString& files) const
+void wxFileDialog::GetFilenames(wxArrayString& files) const
{
#ifdef __WXGTK24__
if (!gtk_check_version(2,4,0))
{
wxString name,ext;
wxSplitPath(files[n], NULL, &name, &ext);
- if (!ext.IsEmpty())
+ if (!ext.empty())
{
name += wxT(".");
name += ext;
wxGenericFileDialog::GetFilenames( files );
}
-void wxFileDialog::GetPaths(wxArrayString& paths) const
+void wxFileDialog::GetPaths(wxArrayString& paths) const
{
#ifdef __WXGTK24__
if (!gtk_check_version(2,4,0))
{
- paths.Empty();
+ paths.Empty();
if (GetWindowStyle() & wxMULTIPLE)
{
- GSList *gpathsi =
+ GSList *gpathsi =
gtk_file_chooser_get_filenames(GTK_FILE_CHOOSER(m_widget));
GSList *gpaths = gpathsi;
while (gpathsi)
g_free(gpathsi->data);
gpathsi = gpathsi->next;
}
- if (gpaths)
+ if (gpaths)
g_slist_free(gpaths);
}
else
SetTitle(message);
}
else
-#endif
+#endif
wxGenericFileDialog::SetMessage( message );
}
UpdateDialog();
}
else
-#endif
+#endif
wxGenericFileDialog::SetPath( path );
}
#ifdef __WXGTK24__
if (!gtk_check_version(2,4,0))
{
- if (wxDirExists(dir))
+ if (wxPathExists(dir))
{
m_dir = dir;
m_path = wxFileName(m_dir, m_fileName).GetFullPath();
}
}
else
-#endif
+#endif
wxGenericFileDialog::SetDirectory( dir );
}
{
m_wildCard = wildCard;
GtkFileChooser* chooser = GTK_FILE_CHOOSER(m_widget);
-
+
// empty current filter list:
GSList* ifilters = gtk_file_chooser_list_filters(chooser);
GSList* filters = ifilters;
ifilters = ifilters->next;
}
g_slist_free(filters);
-
+
// parse filters
wxArrayString wildDescriptions, wildFilters;
if (!wxParseCommonDialogsFilter(m_wildCard, wildDescriptions, wildFilters))
after = after.AfterLast(wxT(';'));
}
while (!after.empty());
-
+
gtk_file_chooser_add_filter(chooser, filter);
}
}
{
#ifdef __WXGTK24__
// set currently selected directory to match the path:
- if (!m_dir.empty() && wxDirExists(m_dir))
+ if (!m_dir.empty() && wxPathExists(m_dir))
{
// NB: This is important -- if we set directory only and not the path,
// then dialog will still remember old path set using previous
if (m_fileName.empty())
gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(m_widget),
wxGTK_CONV(m_dir));
-
+
gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(m_widget),
wxGTK_CONV(m_dir));
}
-
+
// if the user set only the directory (e.g. by calling SetDirectory)
// and not the default filename, then we don't want to set the filename:
if (!m_fileName.empty())
{
gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(m_widget),
wxGTK_CONV(m_path));
-
+
// pre-fill the filename when saving, too (there's no text entry
// control when opening a file, so it doesn't make sense to
// do this when opening files):
GSList *filters = fnode;
GtkFileFilter *current =
gtk_file_chooser_get_filter(GTK_FILE_CHOOSER(m_widget));
-
+
int i = 0;
m_filterIndex = 0;
while (fnode)
dialog->SetPath(filename);
dialog->UpdateFromDialog();
-
+
wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK);
event.SetEventObject(dialog);
dialog->GetEventHandler()->ProcessEvent(event);
wxFileDialog *dialog)
{
wxapp_install_idle_handler();
-
+
if (response == GTK_RESPONSE_ACCEPT)
gtk_filedialog_ok_callback(w, dialog);
else if (response == GTK_RESPONSE_CANCEL)
else // "delete"
{
gtk_filedialog_cancel_callback(w, dialog);
- dialog->m_destroyed_by_delete = TRUE;
+ dialog->m_destroyed_by_delete = true;
}
}
#endif
#ifdef __WXGTK24__
if (!gtk_check_version(2,4,0))
{
- m_needParent = FALSE;
- m_destroyed_by_delete = FALSE;
+ m_needParent = false;
+ m_destroyed_by_delete = false;
if (!PreCreation(parent, pos, wxDefaultSize) ||
!CreateBase(parent, wxID_ANY, pos, wxDefaultSize, style,
GtkWindow* gtk_parent = NULL;
if (parent)
gtk_parent = GTK_WINDOW(parent->m_widget);
-
+
gchar* ok_btn_stock;
if ((style & wxSAVE) == wxSAVE)
{
NULL);
gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(m_widget), multiple);
-
+
gtk_signal_connect(GTK_OBJECT(m_widget),
- "response",
+ "response",
GTK_SIGNAL_FUNC(gtk_filedialog_response_callback),
(gpointer*)this);
-
+
m_path = m_dir;
if (!m_path.empty() && m_path.Last() != wxT('/'))
m_path += wxT('/');
m_path += m_fileName;
SetPath(m_path);
-
+
SetWildcard(wildCard);
SetFilterIndex(0);
}
return wxGenericFileDialog::Show( show );
}
-void wxFileDialog::GetFilenames(wxArrayString& files) const
+void wxFileDialog::GetFilenames(wxArrayString& files) const
{
#ifdef __WXGTK24__
if (!gtk_check_version(2,4,0))
{
wxString name,ext;
wxSplitPath(files[n], NULL, &name, &ext);
- if (!ext.IsEmpty())
+ if (!ext.empty())
{
name += wxT(".");
name += ext;
wxGenericFileDialog::GetFilenames( files );
}
-void wxFileDialog::GetPaths(wxArrayString& paths) const
+void wxFileDialog::GetPaths(wxArrayString& paths) const
{
#ifdef __WXGTK24__
if (!gtk_check_version(2,4,0))
{
- paths.Empty();
+ paths.Empty();
if (GetWindowStyle() & wxMULTIPLE)
{
- GSList *gpathsi =
+ GSList *gpathsi =
gtk_file_chooser_get_filenames(GTK_FILE_CHOOSER(m_widget));
GSList *gpaths = gpathsi;
while (gpathsi)
g_free(gpathsi->data);
gpathsi = gpathsi->next;
}
- if (gpaths)
+ if (gpaths)
g_slist_free(gpaths);
}
else
SetTitle(message);
}
else
-#endif
+#endif
wxGenericFileDialog::SetMessage( message );
}
UpdateDialog();
}
else
-#endif
+#endif
wxGenericFileDialog::SetPath( path );
}
#ifdef __WXGTK24__
if (!gtk_check_version(2,4,0))
{
- if (wxDirExists(dir))
+ if (wxPathExists(dir))
{
m_dir = dir;
m_path = wxFileName(m_dir, m_fileName).GetFullPath();
}
}
else
-#endif
+#endif
wxGenericFileDialog::SetDirectory( dir );
}
{
m_wildCard = wildCard;
GtkFileChooser* chooser = GTK_FILE_CHOOSER(m_widget);
-
+
// empty current filter list:
GSList* ifilters = gtk_file_chooser_list_filters(chooser);
GSList* filters = ifilters;
ifilters = ifilters->next;
}
g_slist_free(filters);
-
+
// parse filters
wxArrayString wildDescriptions, wildFilters;
if (!wxParseCommonDialogsFilter(m_wildCard, wildDescriptions, wildFilters))
after = after.AfterLast(wxT(';'));
}
while (!after.empty());
-
+
gtk_file_chooser_add_filter(chooser, filter);
}
}
{
#ifdef __WXGTK24__
// set currently selected directory to match the path:
- if (!m_dir.empty() && wxDirExists(m_dir))
+ if (!m_dir.empty() && wxPathExists(m_dir))
{
// NB: This is important -- if we set directory only and not the path,
// then dialog will still remember old path set using previous
if (m_fileName.empty())
gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(m_widget),
wxGTK_CONV(m_dir));
-
+
gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(m_widget),
wxGTK_CONV(m_dir));
}
-
+
// if the user set only the directory (e.g. by calling SetDirectory)
// and not the default filename, then we don't want to set the filename:
if (!m_fileName.empty())
{
gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(m_widget),
wxGTK_CONV(m_path));
-
+
// pre-fill the filename when saving, too (there's no text entry
// control when opening a file, so it doesn't make sense to
// do this when opening files):
GSList *filters = fnode;
GtkFileFilter *current =
gtk_file_chooser_get_filter(GTK_FILE_CHOOSER(m_widget));
-
+
int i = 0;
m_filterIndex = 0;
while (fnode)
if ( (ofn->Flags & OFN_ALLOWMULTISELECT) &&
ofn->lpstrFile[ofn->nFileOffset-1] != wxT('\0') )
{
- if ( wxDirExists(ofn->lpstrFile) )
+ if ( wxPathExists(ofn->lpstrFile) )
{
// 1st component is dir => multiple files selected
ofn->nFileOffset = wxStrlen(ofn->lpstrFile)+1;
return (wxChar *)wxGetHomeDir(&s_home);
}
-bool wxDirExists(const wxString& dir)
-{
-#ifdef __WXMICROWIN__
- return wxPathExist(dir);
-#elif defined(__WIN32__)
- DWORD attribs = GetFileAttributes(dir);
- return ((attribs != (DWORD)-1) && (attribs & FILE_ATTRIBUTE_DIRECTORY));
-#endif // Win32/__WXMICROWIN__
-}
-
bool wxGetDiskSpace(const wxString& path, wxLongLong *pTotal, wxLongLong *pFree)
{
#ifdef __WXWINCE__
#ifdef __WXWINCE__
case VER_PLATFORM_WIN32_CE:
s_ver = wxWINDOWS_CE;
-#endif
+#endif
}
-#endif
+#endif
}
}
char *wxBuffer = new wxChar[256];
#ifndef __EMX__
- if (sUser1 != _T(""))
+ if (!sUser1.empty())
{
wxChar zTmp[64];
}
}
#endif
- if (sUser1 == _T(""))
+ if (sUser1.empty())
{
if ((zHome = wxGetenv(_T("HOME"))) != NULL)
{
return NULL; // No home known!
}
-bool wxDirExists(
- const wxString& rDir
-)
-{
- return (::DosSetCurrentDir(WXSTRINGCAST rDir));
-}
-
wxString WXDLLEXPORT wxPMErrorToStr(
ERRORID vError
)
return NULL;
}
-bool wxDirExists(const wxString& dir)
-{
- return false;
-}
-
bool wxGetDiskSpace(const wxString& path, wxLongLong *pTotal, wxLongLong *pFree)
{
return false;
name = m_factory->GetInternalName(
path.substr(rootlen, wxString::npos));
- bool isDir = wxDirExists(path);
+ bool isDir = wxPathExists(path);
if (isDir)
name += _T("/");