Commit 257b35e3 authored by Sebastian Eichelbaum's avatar Sebastian Eichelbaum

[CHANGE] - kernel now uses the current working directory as path

parent 99ad743a
...@@ -170,38 +170,40 @@ void WKernel::findAppPath() ...@@ -170,38 +170,40 @@ void WKernel::findAppPath()
// This might be the better alternative to the below code but it does not print the path to the executable, but to the current // This might be the better alternative to the below code but it does not print the path to the executable, but to the current
// working directory, which in the unix world is the better choice as path // working directory, which in the unix world is the better choice as path
// char* sappPath = get_current_dir_name(); char* appPath = get_current_dir_name();
int length; // int length;
char appPath[255]; //char appPath[255];
length = readlink( "/proc/self/exe", appPath, sizeof( appPath ) ); //length = readlink( "/proc/self/exe", appPath, sizeof( appPath ) );
// Catch some errors //// Catch some errors
if ( length < 0 ) //if ( length < 0 )
{ //{
WLogger::getLogger()->addLogMessage( "Error resolving symlink /proc/self/exe.", "Kernel", LL_ERROR ); // WLogger::getLogger()->addLogMessage( "Error resolving symlink /proc/self/exe.", "Kernel", LL_ERROR );
} //}
if ( length >= 255 ) //if ( length >= 255 )
{ //{
WLogger::getLogger()->addLogMessage( "Path too long. Truncated.", "Kernel", LL_ERROR ); // WLogger::getLogger()->addLogMessage( "Path too long. Truncated.", "Kernel", LL_ERROR );
} //}
// the string this readlink() function returns is appended with a '@'. //// the string this readlink() function returns is appended with a '@'.
appPath[length] = '\0'; //appPath[length] = '\0';
// strip off the executable name //// strip off the executable name
while ( appPath[length] != '/' ) //while ( appPath[length] != '/' )
{ //{
appPath[length] = '\0'; // appPath[length] = '\0';
--length; // --length;
assert( length >= 0 ); // assert( length >= 0 );
} //}
m_AppPath = appPath; m_AppPath = appPath;
m_AppPath += "/";
m_shaderPath = m_AppPath + "shaders/";
std::string shaderPath( appPath ); // getcwd/get_current_dir_name() mallocs memory, free it here
m_shaderPath = shaderPath + "shaders/"; delete appPath;
#elif defined( __APPLE__ ) #elif defined( __APPLE__ )
char path[1024]; char path[1024];
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment