|
|
|
@ -5,17 +5,15 @@
|
|
|
|
|
|
|
|
|
|
#include "amigaos4.h" |
|
|
|
|
|
|
|
|
|
// TODO: check if this is set in SDK
|
|
|
|
|
#define MAX_PATH_SIZE 255 |
|
|
|
|
|
|
|
|
|
static char *getFullPath(const char *path) |
|
|
|
|
{ |
|
|
|
|
char *appPath = malloc(sizeof(char) * MAX_PATH_SIZE); |
|
|
|
|
char *appPath = malloc(sizeof(char) * MAX_DOS_NAME); |
|
|
|
|
|
|
|
|
|
BPTR pathLock = Lock(path, SHARED_LOCK); |
|
|
|
|
if (pathLock) |
|
|
|
|
{ |
|
|
|
|
NameFromLock(pathLock, appPath, sizeof(char) * MAX_PATH_SIZE); |
|
|
|
|
NameFromLock(pathLock, appPath, sizeof(char) * MAX_DOS_NAME); |
|
|
|
|
// printf("DBG: getFullPath() path: %s\nappPath: %s\n", path, appPath);
|
|
|
|
|
UnLock(pathLock); |
|
|
|
|
|
|
|
|
|
return appPath; |
|
|
|
@ -26,16 +24,25 @@ static char *getFullPath(const char *path)
|
|
|
|
|
|
|
|
|
|
char *_fullpath(const char *path) |
|
|
|
|
{ |
|
|
|
|
if (strcmp(path, ".")) |
|
|
|
|
static char prvPath[MAX_DOS_NAME]; |
|
|
|
|
static char result[MAX_DOS_NAME]; |
|
|
|
|
|
|
|
|
|
// printf("DBG: prvPath: %s\npath: %s\nresult:%s\n", prvPath, path, result);
|
|
|
|
|
if (!strcmp(path, prvPath)) |
|
|
|
|
{ |
|
|
|
|
return getFullPath(path); |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
strcpy(prvPath, path); |
|
|
|
|
|
|
|
|
|
if (!strcmp(path, ".")) |
|
|
|
|
{ |
|
|
|
|
// TODO: Add code to get the name of the executable
|
|
|
|
|
return getFullPath("PROGDIR:lite"); |
|
|
|
|
strcpy(result, getFullPath("PROGDIR:lite")); |
|
|
|
|
// printf("DBG: result:%s\n", result);
|
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return NULL; |
|
|
|
|
strcpy(result, getFullPath(path)); |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|