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); char *appPath = malloc(sizeof(char) * MAX_PATH_SIZE);
if (strcmp(path, ".")) BPTR pathLock = Lock(path, SHARED_LOCK);
if (pathLock)
{ {
/* NameFromLock(pathLock, appPath, sizeof(char) * MAX_PATH_SIZE);
STRPTR appPath = AllocVecTags(sizeof(char) * MAX_PATH_SIZE, UnLock(pathLock);
AVT_Type, MEMF_SHARED,
AVT_ClearWithValue, "\0",
TAG_DONE);
*/
char *appPath = malloc(sizeof(char) * MAX_PATH_SIZE);
BPTR pathLock = Lock(path, SHARED_LOCK); return appPath;
if (pathLock) }
{
//BPTR parentLock = ParentDir(pathLock); return NULL;
NameFromLock(pathLock, appPath, sizeof(char) * MAX_PATH_SIZE); }
//printf("DBG: apppath %s\n", appPath); char *_fullpath(const char *path)
//UnLock(parentLock); {
UnLock(pathLock); if (strcmp(path, "."))
{
return appPath; return getFullPath(path);
//return "ram:"; }
}
//printf("DBG: pathLock failed\n"); if (!strcmp(path, "."))
} {
// TODO: Add code to get the name of the executable
// TODO: Deal with . path return getFullPath("PROGDIR:lite");
if (!strcmp(path, "."))
{
//printf("DBG: return app folder\n");
return "Applications:Programming/workspace/MyProjects/lite-xl_v1.16.12";
} }
return NULL; return NULL;