<div dir="ltr"><div>I have managed to deploy my game on the actual device and now I'm trying to debug my code in order to find out why it crashes when starting the game.</div><div><br></div>At some point I try to get the full path of my game by using the code below:<div>

<br></div><div><br></div><div><pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(0,128,0)">//</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">find</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">fullpath</span></pre>


<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(128,128,0)">char</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">full_path</span><span style="color:rgb(0,0,0)">[</span><span style="color:rgb(0,0,128)">PATH_MAX</span><span style="color:rgb(0,0,0)">];</span></pre>


<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(0,0,0)">memset</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">&(</span><span style="color:rgb(0,0,0)">full_path</span><span style="color:rgb(0,0,0)">[</span><span style="color:rgb(0,0,128)">0</span><span style="color:rgb(0,0,0)">]),</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">'\0'</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">ARRAY_SIZE</span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(0,0,0)">full_path</span><span style="color:rgb(0,0,0)">)-</span><span style="color:rgb(0,0,128)">1</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">);</span></pre>


<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(128,0,128)">ssize_t</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">chars</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">=</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">readlink</span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(0,128,0)">"/proc/self/exe"</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(0,0,0)">full_path</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(0,0,128)">PATH_MAX</span><span style="color:rgb(0,0,0)">);</span></pre>


<pre style="margin-top:0px;margin-bottom:0px"><br></pre></div><div><br></div><div>when tapping the game's icon to start it the code above returns as a value:</div><div><br></div><div>                   <b>/usr/libexec/mapplauncherd/booster-silica-qt5</b></div>

<div><br></div><div><br></div><div>which is wrong. If I ssh in the device and type the name of the game to start it then the above code returns:</div><div><br></div><div>                   <b>/usr/bin/FarWest</b><br></div>

<div><br></div><div>which is the correct path, so I can understand why my game crashes. The question is why I get wrong value and how to fix it?</div><div><br></div><div>I use the above code so that I can backwards traverse the full_path array in order to get the game's name.</div>

<div><br></div></div>