[wxMac] Random successes open files via wxFile
David Nock
nockdgatwork at hotmail.com
Thu Aug 23 15:08:11 PDT 2007
[Apologies if this message appears multiple times - having mailserver
issues]
Hi,
I'm experiencing an odd problem when opening files with wxFile. Probably
about 60% of the time it
fails with error 2 (no such file or directory). All the files I am testing
with are in the same folder,
all are owned by my user and all have the same permissions. To confuse the
process further, I duplicated
(in Finder) one of the files that couldn't be read and the duplicate could
be read but the original still fails.
If I run the program again, I get exactly the same results. i.e. the same
files succeed and fail.
The files are a mixture of sizes and types.
If I roll my wx library back to 10 Aug 2007 then this all works fine.
Below is a testing method
wxString aDir = ::wxDirSelector(_T("Select the source directory."));
if(!aDir.empty())
{
wxPuts(_("Dir selected.")+aDir);
wxDir dir(aDir);
if ( !dir.IsOpened() )
{
wxPuts("Error opening directory.");
return;
}
wxPuts("Enumerating object files in current directory:");
wxString filename;
bool cont = dir.GetFirst(&filename, _(""), wxDIR_FILES);
while ( cont )
{
wxString file = aDir + _("/") + filename;
wxPuts(file);
wxFile fsIn(file);
if ( !fsIn.IsOpened() )
wxPuts(_("ERROR: couldn't open file."));
else
{
wxPuts(_("File opened."));
fsIn.Close();
}
cont = dir.GetNext(&filename);
}
}
else
wxPuts(_("No dir selected."));
Using wxSVN head - debug/unicode, Intel Mac with 10.4.10, gcc 4
Cheers
Dave
_________________________________________________________________
Live Search delivers results the way you like it. Try live.com now!
http://www.live.com
More information about the wx-users
mailing list