Replies: 2 comments 4 replies
-
|
你可以先用 |
Beta Was this translation helpful? Give feedback.
3 replies
-
|
这个库是对c++的std::filesystem的封装,所以大部分行为都会保持一致。 fs.exists/fs.is_directory不是一个轻量级的操作,如果不是必须应该尽可能减少使用。这就是为什么不会做提前检查,包括c++的std::filesystem也是这样。 搜了一下引擎对fs.pairs的使用,大多数情况都无需判断fs.is_directory,因为在上下文中已经隐含了这个条件的成立。只在需要的时候检查,或者用fs.create_directories确保它总是对的。 |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
使用bee.filesystem的pairs函数遍历磁盘目录时,如果目录不存在游戏会卡死(类似死循环),调试后报错堆栈如下

能否不抛出异常,只输出一条warning什么的。不然我觉得上层逻辑写起来心智压力也太大了,每次遍历前还得判断下目录是否存在。一般在这种情况下,目录不存在就等于目录里面是空的。能否在控制台打印出异常信息,我现在必须得挂调试器才知道发生了啥事情~
Beta Was this translation helpful? Give feedback.
All reactions