[Date Prev][Date Next][Thread Prev][Thread Next][Thread Index]

Re: [XaraXtreme-dev] Cannot open default template with spaces - "800 by 600 drawing.xar" - (Mac only?)

Ben Fowler wrote:
Here is the real deal.

I have set a breakpoint in wxZipFSHandler::OpenFile ( ) at
../src/common/fs_zip.cpp:123, and have this backtrace:

#0  wxZipFSHandler::OpenFile (this=0xb572330, location=@0xbfff91b0) at
#1  0x02847354 in wxFileSystem::OpenFile (this=0xb56f0e0,
location=@0xbfff9220) at ../src/common/filesys.cpp:400
#2  0x0063f870 in CamResource::OpenwxFSFile (this=0xbfffab04,
pFileName=0xbfffab24) at
#3  0x00582ecc in CCamDoc::LoadDefaultDocument (this=0xbaf8c00) at

At that point in the function I am looking for a zip entry with the name:

(gdb) x/67 right.m_pchData

If you do x/67wc you will get wide characters which makes reading it
rather easier.

But this seems to be a name without underscores, but with spaces.

(gdb) x/67 ent.m_Name.m_pchData

That seems to be the same name, but with the underscores.

1. Confirmation that that zip entry is correct - I think that I have
posted this before.

It should be looking for the file with underscores, which is what
is in the zip file.

2. Is it the case that I am looking for the wrong thing - everybody
else has a target with underscores.


3. Am I falling to convert my path or filename - spaces to underscores
- somewhere, if so where.

OK, so the path name comes indirectly from the static member variable
DocOps::ms_strDefaultDrawingTemplate. This is set up around line
1300 of menuops.cpp. It first tries to load it from your preferences
file (so you might try deleting your preferences to see if you
have a bogus value in there from before Luke did the conversion).
If the preference value is empty, it uses a string from
IDS_DEFAULTDOCNAME. This is the version with the underscores in.

It sounds to me like you might have a bogus value in your preference
file that needs clearing out.

But you could look around line 1320 of menuops.cpp (that's where
it first reads it), then look at the various calls to
CamDoc::SetTemplate() (ignoring the clipboard ones etc.) and

Unfortunately I am not 100% per cent that there is a bug here, but
having posted (above) the behaviour I observe, could someone add info
concerning the behaviour that I should be expecting, and I can compare
the two.

(gdb) x/80wc right.m_pchData
0x298d258:	56 '8'	48 '0'	48 '0'	95 '_'
0x298d268:	98 'b'	121 'y'	95 '_'	54 '6'
0x298d278:	48 '0'	48 '0'	95 '_'	100 'd'
0x298d288:	114 'r'	97 'a'	119 'w'	105 'i'
0x298d298:	110 'n'	103 'g'	46 '.'	120 'x'
0x298d2a8:	97 'a'	114 'r'	0 '\0' <...snip...>

This is what I see in wxZipFSHander::OpenFile. Clearly this later
matches "ent".