Fixed loading the current folder from terminal using the dot character
This commit is contained in:
parent
1c3f766e6b
commit
c5309e04d6
|
@ -50,6 +50,8 @@ https://git.walkero.gr/walkero/lite-xl/issues
|
||||||
### Fixed
|
### Fixed
|
||||||
- Fixed the assertion error and crash when the window is resized (#2)
|
- Fixed the assertion error and crash when the window is resized (#2)
|
||||||
- Fixed the resolution on fullscreen toggle to be like the workbench (#4)
|
- Fixed the resolution on fullscreen toggle to be like the workbench (#4)
|
||||||
|
- Fixed loading the current folder from terminal using the dot, like
|
||||||
|
`lite .` or without it (#3)
|
||||||
|
|
||||||
## [1.16.12.4] - 2021-12-31
|
## [1.16.12.4] - 2021-12-31
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
|
@ -73,7 +73,7 @@ static void get_exe_filename(char *buf, int sz) {
|
||||||
_NSGetExecutablePath(exepath, &size);
|
_NSGetExecutablePath(exepath, &size);
|
||||||
realpath(exepath, buf);
|
realpath(exepath, buf);
|
||||||
#elif __amigaos4__
|
#elif __amigaos4__
|
||||||
strcpy(buf, _fullpath("."));
|
strcpy(buf, _fullpath("./lite"));
|
||||||
#else
|
#else
|
||||||
strcpy(buf, "./lite");
|
strcpy(buf, "./lite");
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
static char *getFullPath(const char *path)
|
static char *getFullPath(const char *path)
|
||||||
{
|
{
|
||||||
char *appPath = malloc(sizeof(char) * MAX_DOS_NAME);
|
char *appPath = malloc(sizeof(char) * MAX_DOS_NAME);
|
||||||
|
|
||||||
BPTR pathLock = Lock(path, SHARED_LOCK);
|
BPTR pathLock = Lock(path, SHARED_LOCK);
|
||||||
if (pathLock)
|
if (pathLock)
|
||||||
{
|
{
|
||||||
|
@ -17,7 +16,18 @@ static char *getFullPath(const char *path)
|
||||||
|
|
||||||
return appPath;
|
return appPath;
|
||||||
}
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static char *getCurrentPath(void)
|
||||||
|
{
|
||||||
|
char *appPath = malloc(sizeof(char) * MAX_DOS_NAME);
|
||||||
|
BPTR pathLock = GetCurrentDir();
|
||||||
|
if (pathLock)
|
||||||
|
{
|
||||||
|
NameFromLock(pathLock, appPath, sizeof(char) * MAX_DOS_NAME);
|
||||||
|
return appPath;
|
||||||
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,13 +43,19 @@ char *_fullpath(const char *path)
|
||||||
|
|
||||||
strcpy(prvPath, path);
|
strcpy(prvPath, path);
|
||||||
|
|
||||||
if (!strcmp(path, "."))
|
if (!strcmp(path, "./lite"))
|
||||||
{
|
{
|
||||||
// TODO: Add code to get the name of the executable
|
// TODO: Add code to get the name of the executable
|
||||||
strcpy(result, getFullPath("PROGDIR:lite"));
|
strcpy(result, getFullPath("PROGDIR:lite"));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!strcmp(path, "."))
|
||||||
|
{
|
||||||
|
strcpy(result, getCurrentPath());
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
strcpy(result, getFullPath(path));
|
strcpy(result, getFullPath(path));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue