# Access directory for AppImage

**URL:** <https://discourse.appimage.org/t/access-directory-for-appimage/2597>\
**Category:** Creating AppImages\
**Created:** [January 26, 2022, 3:37pm UTC](https://discourse.appimage.org/t/access-directory-for-appimage/2597 "2022-01-26T15:37:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![utlisateur](https://avatars.discourse-cdn.com/v4/letter/u/ecae2f/32.png) [@utlisateur](https://discourse.appimage.org/u/utlisateur)\
**Post date:** [January 26, 2022, 3:37pm UTC](https://discourse.appimage.org/t/access-directory-for-appimage/2597/1 "2022-01-26T15:37:57Z")

</div>

Hello. I built an X.AppImage application from a .deb package with the pkg2appimage tool.

The application runs fine.

The problem: during its execution, the X application (not AppImage) reads files in a /usr/share/ directory.

The X.AppImage application does the same thing and reads in the /usr/share/ directory (instead of X.AppDir/usr/share/)

How to force X.AppImage to use the directory “X.AppDir/usr/share/”

---

<div class="post-metadata">

**Author:** ![mgord9518](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.appimage.org/mgord9518/32/459_2.png) [@mgord9518](https://discourse.appimage.org/u/mgord9518)\
**Post date:** [March 14, 2022, 2:48pm UTC](https://discourse.appimage.org/t/access-directory-for-appimage/2597/2 "2022-03-14T14:48:16Z")

</div>

You can’t force it without editing the source code if it’s hardcoded. This is an annoyance I noticed with the mGBA AppImage as it tries to find shaders under /usr/share as well.

Maybe you’re lucky and the application has a flag or environment variable to change its search location? That’s all down to the app dev though

---

<div class="post-metadata">

**Author:** ![probono](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.appimage.org/probono/32/81_2.png) [@probono](https://discourse.appimage.org/u/probono)\
**Post date:** [March 31, 2022, 8:41pm UTC](https://discourse.appimage.org/t/access-directory-for-appimage/2597/3 "2022-03-31T20:41:43Z")

</div>

> [@utlisateur](#):
>
> How to force X.AppImage to use the directory “X.AppDir/usr/share/”

Change the source code of the application to load its resources from a path relative to the main executable, rather than from an absolute path.

This is known as “making an application relocatable”.

> **[Creating an AppImage, make your code relocatable](https://azubieta.net/p/creating-an-appimage-make-your-code-relocatable/)**
>
> The first step on the AppImage packaging process is to make the application code relocatable. This implies that every application resource path must be resolved at runtime. This includes icons, fonts, databases, plugins and any other resource that...
