News:

As usual while waiting for the next release - don't forget to check the nightly builds in the forum.

Main Menu

Prefix finding code still broken

Started by afb, November 07, 2006, 11:03:30 AM

Previous topic - Next topic

afb

Switched the Mac code to use the new GetAppPath implemenation, but it still doesn't work...

Seems like it's picking the wrong level and missing a ".." ? Wonder why SELFPATH doesn't ?

afb

(I would post the real output here, if forum wouldn't barf ?)

But it is looking in /usr/ local/ bin/ share/ codeblocks
Without the spaces of course, had to add those to post...

mandrav

QuoteWonder why SELFPATH doesn't ?

Have you had a quick glance in src/prefix.cpp? Maybe it's missing a define for Mac or something?
Be patient!
This bug will be fixed soon...

afb

BINRELOC is only for Linux, so I did my own implementation.
But I have must have missed what it was supposed to return.

i.e. currently I return the path to the application in GetAppPath,
but apparently it is expecting the prefix to be returned instead ?  :o


    #ifdef APP_PREFIX
        wxString data = wxT(APP_PREFIX); // under linux, get the preprocessor value
    #else
        wxString data = GetAppPath();
    #endif


Will fix it when I move to the "share/codeblocks" subdirectory.
Just wondered if there was a bug with the other code path too ?

i.e. shouldn't the above instead be: GetAppPath() + _T("/..") ?

afb

#4
BTW; We will use a "share/codeblocks" dir on Win/Mac too, I think ?
(the nightly build for Windows seem to use share/CodeBlocks, but...)

Rather than the "standard" system path (from wxStandardPathsBase):

    // return the location of the applications global, i.e. not user-specific,
    // data files
    //
    // prefix/share/appname under Unix, c:\Program Files\appname under Windows,
    // appname.app/Contents/SharedSupport app bundle directory under Mac
    virtual wxString GetDataDir() const = 0;

Which doesn't even look to be all that correct for Windows and Mac OS X.
(SharedSupport is supposed to contain examples and templates and such)

so it will look in: CodeBlocks.app/Contents/Resources/share/codeblocks dir,
and if that doesn't exist it will look in $PREFIX/share/codeblocks like above.

Pecan

Quote
and if that doesn't exist it will look in $PREFIX/share/codeblocks like above.

Thank you for that.

When developing I'd like to keep my mac file structure as close to linux structure as possible. Jumping around in the forest of mac hidden files wastes a lot of time.

afb

#6
Actually it will first ask for the Resources directory of the bundle, and it if isn't a bundle that will return something useless like "codeblocks" (without the path) and then it will revert to plan B which is calling GetAppPath that in returns uses the Mach-O binary path. The idea is to return the directory that corresponds to the program that is being run...

For the preferences wxMac will "only" look in ~/Library/Application\ Support/CodeBlocks, though. wxGTK will instead use the $HOME/.codeblocks directory on Mac OS X too I think.

afb

Quote from: afb on November 07, 2006, 01:33:09 PM

    #ifdef APP_PREFIX
        wxString data = wxT(APP_PREFIX); // under linux, get the preprocessor value
    #else
        wxString data = GetAppPath();
    #endif


Will fix it when I move to the "share/codeblocks" subdirectory.
Just wondered if there was a bug with the other code path too ?

i.e. shouldn't the above instead be: GetAppPath() + _T("/..") ?

Changed it to use app path + "..", which should be something like:
/usr/local/bin/../share/codeblocks, which should be working ?

Also fixed a bug on Mac OS X, I mistakenly assumed that just because
you pass the length by pointer it would actually return something useful.