diff --git a/main.cpp b/main.cpp index 7cf8522..8f0df86 100644 --- a/main.cpp +++ b/main.cpp @@ -53,7 +53,7 @@ void logo() <<" / \\/ / _` / __|/ _` | |\n" <<" / /\\ / (_| \\__ \\ (_| | |\n" <<" \\_\\ \\/ \\__,_|___/\\__,_|_|\n" - <<"nasal ver : "<<__nasver<<"\n" + <<"nasal ver : "<<__nasver<<" ("<<__DATE__<<")\n" <<"c++ std : "<<__cplusplus<<"\n" <<"thanks to : https://github.com/andyross/nasal\n" <<"code repo : https://github.com/ValKmjolnir/Nasal-Interpreter\n" diff --git a/nasal_builtin.h b/nasal_builtin.h index 69243ca..a8d31ef 100644 --- a/nasal_builtin.h +++ b/nasal_builtin.h @@ -133,8 +133,7 @@ nas_ref builtin_split(nas_ref* local,nasal_gc& gc) gc.temp=nil; return res; } - usize last=0; - usize pos=s.find(deli,last); + usize last=0,pos=s.find(deli,0); while(pos!=string::npos) { if(pos>last) diff --git a/nasal_import.h b/nasal_import.h index 1b38c41..2fce7fc 100644 --- a/nasal_import.h +++ b/nasal_import.h @@ -34,8 +34,7 @@ nasal_import::nasal_import(nasal_err& e):lib_loaded(false),nerr(e){ char sep=':'; #endif string PATH=getenv("PATH"); - usize last=0; - usize pos=PATH.find(sep,last); + usize last=0,pos=PATH.find(sep,0); while(pos!=string::npos) { string dirpath=PATH.substr(last,pos-last); diff --git a/stl/file.nas b/stl/file.nas index ddd7de5..850a8c4 100644 --- a/stl/file.nas +++ b/stl/file.nas @@ -5,6 +5,8 @@ var file={ SEEK_CUR:io.SEEK_CUR, SEEK_END:io.SEEK_END, new: func(filename,mode="r"){ + if(!io.exists(filename)) + return nil; var fd=io.open(filename,mode); return { close: func(){io.close(fd);}, @@ -24,6 +26,8 @@ var file={ }; var find_all_files=func(path){ + if(!io.exists(path)) + return []; var dd=unix.opendir(path); var res=[]; while(var n=unix.readdir(dd))