Menu Content/Inhalt
Home arrow Forum

Articles

Poker Tips

Login






Lost Password?
No account yet? Register
PokerTH - Forum
Welcome, Guest
Please Login or Register.    Lost Password?
SVN rev884 - pixmap issues (1 viewing) (1) Guest
Go to bottom Post Reply Favoured: 0
TOPIC: SVN rev884 - pixmap issues
#1070
Inte (User)
Fresh Boarder
Posts: 8
graphgraph
User Offline Click here to see the profile of this user
Re:SVN rev884 - pixmap issues 1 Year, 3 Months ago Karma: 0  
I patched pokerth_game.pro's data.path from /usr/share/pokerth/data to /usr/share/games/pokerth/data

Then I installed the bin to /usr/games/bin and the data/* to /usr/share/games/pokerth/data

What am I missing? Overlooked I some Makefile settings?
 
Report to moderator   Logged Logged  
 
  The administrator has disabled public write access.
#1072
Inte (User)
Fresh Boarder
Posts: 8
graphgraph
User Offline Click here to see the profile of this user
Re:SVN rev884 - pixmap issues 1 Year, 3 Months ago Karma: 0  
<Inte> why is the binary 23mb big? :/
<Scytale> # strings pokerth | grep share/
<Scytale> /../share/pokerth/data/
<Scytale> I'll call that "broken".
<Inte> weird
<Scytale> Hah. I got it.
<Scytale> "ln -s /usr/share/games/pokerth/data/ /data" works. An "strace pokerth 2>&1 | grep ENOENT" made me try this.
<Scytale> open("/data/gfx/cards/default/flipside.png.bmp", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
<Scytale> and lots and lots more
 
Report to moderator   Logged Logged  
 
  The administrator has disabled public write access.
#1074
Scytale (User)
Fresh Boarder
Posts: 4
graphgraph
User Offline Click here to see the profile of this user
Re:SVN rev884 - pixmap issues 1 Year, 3 Months ago Karma: 1  
Okay, after playing around a bit (actually, a lot), I found the source of the problems.

Remember, we install the binary to /usr/games/bin (the file is therefore called /usr/games/bin/pokerth, but this is not a subdirectory!) and the data to /usr/share/games/pokerth/data/.

Now, PokerTH can't find its data directory. Looking into the config file (of course I've deleted it first) reveals that AppDataDir is set to "/data/", and indeed, strace confirms that PokerTH is looking for a "data" directory in the root directory of my system. The question is, why does it think that "/data/" is the correct directory?

To debug it, I've modified src/gui/qt/qttools/qthelper/qthelper.cpp like that:
Code:

Index: qthelper.cpp =================================================================== --- qthelper.cpp (revision 890) +++ qthelper.cpp (working copy) @@ -34,22 +34,22 @@ { QString path = QCoreApplication::instance()->applicationDirPath(); -#ifdef _WIN32 - path += "/data/"; +#ifdef _WIN32 + path += "/dataA/"; #else #ifdef __APPLE__ if (QRegExp("Contents/MacOS/?$"«»).indexIn(path) != -1) { // pointing into an macosx application bundle - path += "/../Resources/data/"; - } else { path += "/data/"; } + path += "/../Resources/dataB/"; + } else { path += "/dataC/"; } #else //Unix if (QRegExp("pokerth/?$"«»).indexIn(path) != -1) { // there is an own application directory - path += "/data/"; + path += "/dataD/"; } else if (QRegExp("bin/?$"«»).indexIn(path) != -1) { // we are in a bin directory. e.g. /usr/bin - path += "/../share/pokerth/data/"; - } else { path += "/data/"; } + path += "/../share/pokerth/dataE/"; + } else { path += "/dataF/"; } #endif #endif @@ -61,25 +61,25 @@ { QString path(appPath.c_str()); -#ifdef _WIN32 - path += "/data/"; +#ifdef _WIN32 + path += "/dataG/"; #else #ifdef __APPLE__ if (QRegExp("Contents/MacOS/?$"«»).indexIn(path) != -1) { // pointing into an macosx application bundle - path += "/../Resources/data/"; - } else { path += "/data/"; } + path += "/../Resources/dataH/"; + } else { path += "/dataI/"; } #else //Unix if (QRegExp("pokerth/?$"«»).indexIn(path) != -1) { // there is an own application directory - path += "/data/"; + path += "/dataJ/"; } else if (QRegExp("bin/?$"«»).indexIn(path) != -1) { // we are in a bin directory. e.g. /usr/bin - path += "/../share/pokerth/data/"; - } else { path += "/data/"; } + path += "/../share/pokerth/dataK/"; + } else { path += "/dataL/"; } #endif #endif return (QDir::cleanPath(path) + "/"«»).toUtf8().constData(); -} \ No newline at end of file +}
As a result, PokerTH now looks for the /dataL/ directory. Then I had a look at src/config/configfile.cpp. This is the relevant part (lines 148 to 154) in "svn blame" view (I'm at r890):
Code:

830 lotodore boost::filesystem::«»path startPath(argv[0]); 830 lotodore 406 doitux ostringstream tempIntToString; 406 doitux tempIntToString << configRev; 406 doitux configList.push_back(ConfigInfo("ConfigRevision", CONFIG_TYPE_INT, tempIntToString.str())); 849 doitux configList.push_back(ConfigInfo("AppDataDir", CONFIG_TYPE_STRING, myQtToolsInterface->getDataPathStdString(startPath.remove_leaf().directory_ string())));
Using argv[0] here is obviously causing problems when running PokerTH from within the $PATH: argv[0] is just "pokerth" in that case, leading to getDataPathStdString() called with an empty string, falling through all "if"s and returning "" + "/data/" as data location. getDataPath() does this far more clever by using QCoreApplication::instance()->applicationDirPath() to get the location of the binary. My first question would be, why are you using two seperate functions to achieve the same goal (getDataPath() and getDataPathStdString())? I'd suggest to let getDataPathStdString() call getDataPath() and convert the types around in order to get a std:tring, if possible (I'm not a C++ programmer). You could then change line 154 in configfile.cpp accordingly. The second question is whether it's possible to add an override possibility to the getDataPath() code, to be able to choose the data dir at compile time. There is already a setting for where to install the data directory in pokerth_game.pro, could this be used? Because for example on Gentoo the getDataPath() code would still not be able to find the data directory (it would look in /usr/games/share/pokerth/data, not /usr/share/games/pokerth/data). We could of course patch qthelper.cpp to fix this on Gentoo, but you probably want to include a fix in PokerTH itself. By the way, thanks for a great piece of software, hope this wasn't too long and helped you reproduce the problem.
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#1075
lotodore (Admin)
Admin
Posts: 275
graphgraph
User Offline Click here to see the profile of this user
Re:SVN rev884 - pixmap issues 1 Year, 3 Months ago Karma: 15  
Scytale wrote:
QUOTE:
getDataPath() does this far more clever by using QCoreApplication::instance()->applicationDirPath() to get the location of the binary.


argv[0] was used to make configfile independant of QT, since it is used in the dedicated server. We'll find a way around this problem, thanks for reporting.
 
Report to moderator   Logged Logged  
 
--
Use IPv6. http://www.sixxs.net/
  The administrator has disabled public write access.
#1087
doitux (Admin)
Admin
Posts: 390
graph
User Online Now Click here to see the profile of this user
Re:SVN rev884 - pixmap issues 1 Year, 3 Months ago Karma: 19  
Hi Scytale

SVN rev 931 should work with "/usr/games/bin/pokerth" and "/usr/share/games/pokerth/data/*". I hope this helps for building an ebuild.
 
Report to moderator   Logged Logged  
 
regards
doitux
________________________________
doitux@pokerth.net
  The administrator has disabled public write access.
#1089
Scytale (User)
Fresh Boarder
Posts: 4
graphgraph
User Offline Click here to see the profile of this user
Re:SVN rev884 - pixmap issues 1 Year, 3 Months ago Karma: 1  
doitux wrote:
QUOTE:
SVN rev 931 should work with "/usr/games/bin/pokerth" and "/usr/share/games/pokerth/data/*". I hope this helps for building an ebuild.

We've talked about this on IRC already, just for the sake of completeness: It seems to work, see the Gentoo ebuild bug. A non-Gentoo-specific solution might still be better, but who knows, maybe you'll get away with this and other distributions won't bother.
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
Go to top Post Reply
Powered by FireBoardget the latest posts directly to your desktop
designed by www.madeyourweb.com