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

Re: Templates? (was Re: [XaraXtreme-dev] XCode - The main goal)



On 27/06/06, Alex Bligh <alex@xxxxxxxxxxx> wrote:
> At
> http://downloads.xara.com/opensource/doxygen/html/camdoc_8cpp-source.html
> line 00325, the  OpenwxFSFile call fails and so both f and Filename
> are NULL; This triggers the 'else' clause at line 00373.
> [ snip ]

It should be opening the one without the spaces in (with the
underscores).

The first thing that my code does is to open the wx Memory Zip
Filesystem or stream, and try to open '800 by 600 drawing.xar' which
fails, and I think that nothing else is tried.

I accept that I may be misunderstanding something, but my first
thought is that without the spaces/underscores, the Darwin code could
open 'default,xar' from memory/resources perhaps owing to a bug
somewhere which has now been fixed; but it cannot open the present
default file.

Just checked it here. See what pFileName
contains when you go into the function (remember it's
a pointer to a UNICODE null terminated string). The
"Templates" version is only used by the installer
(which you aren't using). The difference in size is that
the Templates version is a xar file with compression on,
and for various tedious reasons the binary one is not
a compressed .xar file (though the whole resources are
zipped).

It is (TCHAR *)"800 by 600 drawing.xar" where each character is 4 bytes.

You should trace into that function and see where it gets to.
It should first go to:
   wxFSFile * CamResource::OpenwxFSFile(const TCHAR * pFileName )
in camresource.cpp. This will get the name of the correct file
to open from CamResource::GetResourceFilePath(). This latter
one will check if the file exists in an overloaded resource
directory (it shouldn't), and if not will assume it should
use the path to the built in zip file (beginning
memory:resources#zip: - It will then try and open it
through wxfilesystem.

I am not saying that I understand every word of that, but I have seen
it try to open the Filename through 'memory:resources#zip' and fail. I
have seen it look for '800 by 600 drawing.xar' when
'800_by_600_drawing.xar' was present.

So you could check that wxFileSystem::OpenFile is passed a
sensible path.

Path or Filename?

If you want to eliminate the zip loader, then try this
from the directory with XaraLX in.

(mkdir restest ; cd restest ; unzip ../wxOil/xrc/resources.xrs)
XaraLX -r restest

That should make a local copy of your resources zip file, and
get XaraLX to load resource from the files, not from the .zip
embedded in the executable. Note I am talking about Camelot
resources, not OS-X resources here.

I will do that in a second or two, it is a good idea. Note that
Resouces whether OS X or any other kind can conveniently be placed in
the application bundle one level up from the executable. This is the
origin of wierd strings starting "@executable_path/../"; it is
possible that we need no longer draw a distinction between OS X
resources and resources in general. Placing Resources in the
application bundle ensures that they are 'always there' and can be
conveniently installed and uninstalled by end users. The other ideal
place for them is the User's ~/Library/Application Support/ directory
- I will need to check, but it is not unreasonable to assume that that
directory is writeable, but that the application bundle is not.

Ben