🐛 fix compilation error of `FindNextFile` in other VS version.

This commit is contained in:
ValKmjolnir 2022-09-23 20:39:34 +08:00
parent dc3770094a
commit c4cac512a6
2 changed files with 15 additions and 16 deletions

View File

@ -1,5 +1,11 @@
# Create VS project | 创建 VS 工程
## First | 首先
Make sure you are using VS 2022.
确保你使用的是 VS 2022。
## How to Create VS project
1. Get code from this repo using `git`.
@ -8,7 +14,9 @@
3. Select `Visual C++`->`Next`->choose `project file location`->write the `project name` at ease->`Finish`.
4. Click `Source Files` in `Search Solution Explorer` at left, right click `main.cpp`, compile.
4. Remove cpp files in `module` to avoid compilation problems.(they should be compiled to dynamic libraries)
5. Click `Source Files` in `Search Solution Explorer` at left, right click `main.cpp`, compile.
## 如何创建VS工程
@ -18,4 +26,6 @@
3. 选择创建`Visual C++`项目->下一步->项目文件位置选择你下载的代码存放的文件夹->填项目名称,随便写->完成。
4. 点开左侧解决方案资源管理器中的`Source Files`,右键点击`main.cpp`,编译。
4. 从项目中去掉 `module` 里的cpp文件以防止编译错误。(那些本应该编译到动态库)
5. 点开左侧解决方案资源管理器中的`Source Files`,右键点击`main.cpp`,编译。

View File

@ -32,18 +32,7 @@
void print_core(std::vector<nas_ref>& elems)
{
for(auto& i:elems)
switch(i.type)
{
case vm_none:std::cout<<"null"; break;
case vm_nil: std::cout<<"nil"; break;
case vm_num: std::cout<<i.num(); break;
case vm_str: std::cout<<i.str(); break;
case vm_vec: i.vec().print(); break;
case vm_hash:i.hash().print(); break;
case vm_func:std::cout<<"func(..){..}";break;
case vm_obj: std::cout<<"<object>"; break;
case vm_co: std::cout<<"<coroutine>"; break;
}
i.print();
}
nas_ref builtin_print(nas_ref* local,nasal_gc& gc)
{
@ -811,8 +800,8 @@ nas_ref builtin_readdir(nas_ref* local,nasal_gc& gc)
if(!handle.objchk(nas_obj::dir))
return nas_err("readdir","not a valid dir handle");
#ifdef _MSC_VER
WIN32_FIND_DATA data;
if(!FindNextFile(handle.obj().ptr,&data))
WIN32_FIND_DATAA data;
if(!FindNextFileA(handle.obj().ptr,&data))
return nil;
return gc.newstr(data.cFileName);
#else