bug fix
This commit is contained in:
+1
-17
@@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
Scanner = {src: String, i: int};
|
Scanner = {src: String, i: int};
|
||||||
|
|
||||||
fun newScanner(src: String) {
|
fun newScanner(src: String) {
|
||||||
@@ -301,20 +302,3 @@ fun parse(src: String) {
|
|||||||
val, err = parseValue(scan);
|
val, err = parseValue(scan);
|
||||||
return val, err;
|
return val, err;
|
||||||
}
|
}
|
||||||
|
|
||||||
fun parseFile(file: String | File) {
|
|
||||||
|
|
||||||
if type(file) == String: {
|
|
||||||
file, err = files.open(file, files.READ);
|
|
||||||
if err != none:
|
|
||||||
return none, err;
|
|
||||||
}
|
|
||||||
|
|
||||||
src, err = files.read(file);
|
|
||||||
if err != none:
|
|
||||||
return none, err;
|
|
||||||
assert(type(src) == String);
|
|
||||||
|
|
||||||
val, err = parse(src);
|
|
||||||
return val, err;
|
|
||||||
}
|
|
||||||
+11352
File diff suppressed because one or more lines are too long
@@ -65,9 +65,17 @@ size_t Runtime_GetCurrentScriptFolder(Runtime *runtime, char *buff, size_t buffs
|
|||||||
{
|
{
|
||||||
const char *path = Runtime_GetCurrentScriptAbsolutePath(runtime);
|
const char *path = Runtime_GetCurrentScriptAbsolutePath(runtime);
|
||||||
if(path == NULL) {
|
if(path == NULL) {
|
||||||
if(getcwd(buff, sizeof(buffsize)) == NULL)
|
if(getcwd(buff, buffsize) == NULL)
|
||||||
return 0;
|
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
|
// This following block is a custom implementation
|
||||||
|
|||||||
Reference in New Issue
Block a user