On Sat, Oct 16, 2010 at 12:57 PM, Orcan Ogetbil wrote:
> This was just reported us at Fedora. Steps to reproduce:
> $ sudo touch /usr/bin/data
> $ hydrogen
>
> Result: Hydrogen is very confused.
>
> The file /usr/bin/data comes with a software called "starlab".
>
> If, for testing purposes, you set /usr/bin/data as a symlink to
> /usr/share/hydrogen/data, then things work.
>
> Is there any quick fix for this?
>
I am attaching a patch that I will probably use on the Fedora package.
I found that, on Linux, hydrogen looks for the data/ directory in
qApp->applicationDirPath() which returns /usr/bin when hydrogen is
installed by an RPM. If /usr/bin/data doesn't exist, then hydrogen
falls back to DATA_PATH which is set to /usr/share/hydrogen/data in
config.h.
I changed the order of this search: First look at
/usr/share/hydrogen/data. If it doesn't exist use
qApp->applicationDirPath().
However, I believe that you made it this way for convenience so you
can run hydrogen directly from your build directory when you are
testing your code.
There are different ways to approach this issue but I am leaving it to you.
Thanks,
Orcan
diff -rupN hydrogen-0.9.4.2.old/libs/hydrogen/src/data_path.cpp hydrogen-0.9.4.2/libs/hydrogen/src/data_path.cpp
--- hydrogen-0.9.4.2.old/libs/hydrogen/src/data_path.cpp 2008-04-22 16:42:36.000000000 -0400
+++ hydrogen-0.9.4.2/libs/hydrogen/src/data_path.cpp 2010-10-16 23:28:33.000000000 -0400
@@ -55,14 +55,13 @@ QString DataPath::get_data_path()
#else
if ( __data_path == "" ) {
- QString qStringPath = qApp->applicationDirPath() + QString ( "/data" ) ;
- __data_path = qStringPath;
-
+ __data_path = DATA_PATH;
QFile file( __data_path );
if ( !file.exists() ) {
- // try using the system wide data dir
- __data_path = DATA_PATH;
+ QString qStringPath = qApp->applicationDirPath() + QString ( "/data" ) ;
+ __data_path = qStringPath;
}
+
}
return __data_path;
#endif
------------------------------------------------------------------------------
Download new Adobe(R) Flash(R) Builder(TM) 4
The new Adobe(R) Flex(R) 4 and Flash(R) Builder(TM) 4 (formerly
Flex(R) Builder(TM)) enable the development of rich applications that run
across multiple browsers and platforms. Download your free trials today!
http://p.sf.net/sfu/adobe-dev2dev
_______________________________________________
Hydrogen-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/hydrogen-devel