42 lines
692 B
C
42 lines
692 B
C
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
|
|
#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);
|
|
|
|
BPTR pathLock = Lock(path, SHARED_LOCK);
|
|
if (pathLock)
|
|
{
|
|
NameFromLock(pathLock, appPath, sizeof(char) * MAX_PATH_SIZE);
|
|
UnLock(pathLock);
|
|
|
|
return appPath;
|
|
}
|
|
|
|
return NULL;
|
|
}
|
|
|
|
char *_fullpath(const char *path)
|
|
{
|
|
if (strcmp(path, "."))
|
|
{
|
|
return getFullPath(path);
|
|
}
|
|
|
|
if (!strcmp(path, "."))
|
|
{
|
|
// TODO: Add code to get the name of the executable
|
|
return getFullPath("PROGDIR:lite");
|
|
}
|
|
|
|
return NULL;
|
|
}
|