Hi Stephan,
Le 30 sept. 09 à 14:54, Stephan Bergmann a écrit :
I guess rtl::Bootstrap needs an absolute file URL for the bootstrap
ini-file (if your Midnight Commander has OOo's brand program dir as
current working dir, that might explain why this relative URL
magically happens to work then).
Yes, you're right : I had something like that in mind, but you find
the right words. To add information, I think I simply did not
intialize things as expected. Proceeeding differently helped me to
solve the issue.
Also note that ini-files have different names on different
platforms (boostraprc vs. bootstrap.ini).
Sorry, I forgot : only Linux is concerned : on Mac OS X, I keep the
Aqua look, same on Windows.
But Linux depends on Gnome or KDE, and this is too heavy to add
that : that's the reason why I searched -sort of- compromise look/perf
What you want to do should be something like the following
(untested, just hacked this in from memory!):
rtl::OUString aUserConfigFile(RTL_CONSTASCII_USTRINGPARAM
("{$BRAND_BASE_DIR/program" SAL_INIFILENAME("bootstrap")
":OOo4KidsIntegrationUserFile}"));
rtl::Bootstrap::expand(aUserConfigFile);
Yes, that was the idea. In fact, was my fault (see the code I used
below).
I didn't find expand, but expandMacro instead ( who givers the
file:///... bla result )
if (aUserConfigFile.getLength() != 0)
osl::FileBase::getSystemPathFromFileURL(aUserConfigFile, aTryFiles
[0]);
Yes this test is better imho than the previous one I used.
Here is what I did (woks perfectly on Linux PowerPC, so on most of
the m IMHO :).
The trick was to get the bootstrap file first and then to instantiate
the Bootstrap, using it. Once that was working, I completed the rest
easely.
rtl::OUString aUserConfigFile;
rtl::OUString aDefaultConfigFile;
rtl::OUString aTryFiles[2];
rtl::OUString aIniPath;
// read the content of bootstraprc is necessary to find the path
to the user configuration file
// ~/.ooo4kids/0.6/user/OOo4Kidsrc.txt
Bootstrap::get( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM
( "BRAND_BASE_DIR") ), aIniPath );
aIniPath += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/
program/" SAL_CONFIGFILE( "bootstrap" ) ) );
Bootstrap aBootstrap(aIniPath);
aBootstrap.getFrom( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM
("OOo4KidsIntegrationUserFile") ), aUserConfigFile );
if (aUserConfigFile.getLength() != 0)
osl::FileBase::getSystemPathFromFileURL( aUserConfigFile, aTryFiles
[0]);
// if OOo4Kidsrc.txt is not found in user install dir, fallback
to the second OOo4Kidsrc.txt (with default values), located in
<install_dir>/presets
aBootstrap.getFrom( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM
("OOo4KidsIntegrationDefaultFile") ), aDefaultConfigFile );
osl::FileBase::getSystemPathFromFileURL(aDefaultConfigFile,
aTryFiles[1]);
and similarly for the DefaultFile.
So did I :)
Thanks a lot for your help, that I really appreciated !!
Eric
--
qɔᴉɹə