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/lua
subprojects/libagg subprojects/libagg
sybprojects/lua sybprojects/lua
lite

View File

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

View File

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