Jump to content

"turn-key" application improvements


codeape
 Share

Recommended Posts

Lets make Leadwerks more independent from where it is run. Today you can not start your game from any other place than the dir where the executable is. This does not work:

/home/user/mygame/mygame.debug
./mygame/mygame.debug

 

Add the following to the Code::Blocks project in the template files:

-Wl,-rpath=\\$$$ORIGIN

 

To make the resource files load from any place add this right before app->Start() in main.cpp of the template files:

#ifdef __linux__
FileSystem::SetDir(FileSystem::ExtractDir(argv[0]));
#else
HMODULE hModule = GetModuleHandle(NULL);
if (hModule != NULL) {
 char exePth[MAX_PATH];
 GetModuleFileName(hModule, exePth, MAX_PATH);
 FileSystem::SetDir(FileSystem::ExtractDir(exePth));
}
#endif

 

This is based on this discussion:

http://www.leadwerks.com/werkspace/topic/10628-shared-lib-libsteam-apiso-loading-question/

  • Upvote 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...