bug fix
This commit is contained in:
@@ -16,7 +16,7 @@ static int bin_new(Runtime *runtime, Object **argv, unsigned int argc, Object *r
|
||||
long long int size = Object_GetInt(argv[0]);
|
||||
|
||||
Object *temp = Object_NewBuffer(size, Runtime_GetHeap(runtime), error);
|
||||
|
||||
|
||||
if(temp == NULL)
|
||||
return -1;
|
||||
|
||||
|
||||
@@ -65,9 +65,17 @@ size_t Runtime_GetCurrentScriptFolder(Runtime *runtime, char *buff, size_t buffs
|
||||
{
|
||||
const char *path = Runtime_GetCurrentScriptAbsolutePath(runtime);
|
||||
if(path == NULL) {
|
||||
if(getcwd(buff, sizeof(buffsize)) == NULL)
|
||||
if(getcwd(buff, buffsize) == NULL)
|
||||
return 0;
|
||||
return strlen(buff);
|
||||
size_t cwdlen = strlen(buff);
|
||||
if (buff[cwdlen-1] == '/')
|
||||
return cwdlen;
|
||||
else {
|
||||
if (cwdlen+1 >= buffsize)
|
||||
return 0;
|
||||
buff[cwdlen] = '/';
|
||||
return cwdlen+1;
|
||||
}
|
||||
}
|
||||
|
||||
// This following block is a custom implementation
|
||||
|
||||
Reference in New Issue
Block a user