#include #include #include #include "morphos.h" #define MAX_DOS_NAME FILENAME_MAX static BOOL getFullPath(const char *path, char *result) { BPTR pathLock = Lock(path, SHARED_LOCK); if (pathLock) { NameFromLock(pathLock, result, sizeof(char) * MAX_DOS_NAME); UnLock(pathLock); return TRUE; } return FALSE; } static BOOL getCurrentPath(char *result) { BOOL success = GetCurrentDirName(result, sizeof(char) * MAX_DOS_NAME); if (!success) { return TRUE; } return FALSE; } char *_fullpath(const char *path) { static char prvPath[MAX_DOS_NAME]; static char result[MAX_DOS_NAME]; if (!strcmp(path, prvPath)) { return result; } strcpy(prvPath, path); if (!strcmp(path, "./lite")) { // TODO: Add code to get the name of the executable if (getFullPath("PROGDIR:lite", result)) { return result; } } if (!strcmp(path, ".")) { if(getCurrentPath(result)) { return result; } } if (getFullPath(path, result)) { return result; } return NULL; }