Fixed a forgotten hardcoded path

This commit is contained in:
George Sokianos 2021-12-21 18:27:25 +00:00
parent 7c85530e92
commit fdd2f3af33
3 changed files with 25 additions and 33 deletions

1
.gitignore vendored
View File

@ -7,3 +7,4 @@ build*
subprojects/lua
subprojects/libagg
sybprojects/lua
lite

View File

@ -72,8 +72,7 @@ static void get_exe_filename(char *buf, int sz) {
realpath(exepath, buf);
#elif __amigaos4__
#include "platform/amigaos4.h"
// TODO: Add code to get the name of the executable
strcpy(buf, _fullpath("PROGDIR:lite"));
strcpy(buf, _fullpath("."));
#else
strcpy(buf, "./lite");
#endif

View File

@ -8,41 +8,33 @@
// TODO: check if this is set in SDK
#define MAX_PATH_SIZE 255
char *_fullpath(const char *path)
static char *getFullPath(const char *path)
{
//rintf("DBG: _fullpath() %s\n", path);
if (strcmp(path, "."))
{
/*
STRPTR appPath = AllocVecTags(sizeof(char) * MAX_PATH_SIZE,
AVT_Type, MEMF_SHARED,
AVT_ClearWithValue, "\0",
TAG_DONE);
*/
char *appPath = malloc(sizeof(char) * MAX_PATH_SIZE);
BPTR pathLock = Lock(path, SHARED_LOCK);
if (pathLock)
{
//BPTR parentLock = ParentDir(pathLock);
NameFromLock(pathLock, appPath, sizeof(char) * MAX_PATH_SIZE);
//printf("DBG: apppath %s\n", appPath);
//UnLock(parentLock);
UnLock(pathLock);
return appPath;
//return "ram:";
}
//printf("DBG: pathLock failed\n");
}
// TODO: Deal with . path
if (!strcmp(path, "."))
{
//printf("DBG: return app folder\n");
return "Applications:Programming/workspace/MyProjects/lite-xl_v1.16.12";
}
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;