Windows上的节点文件模式?
发布时间:2020-12-14 02:50:39 所属栏目:Windows 来源:网络整理
导读:在 Node中,文件模式(例如,对于 fs.open)被定义为 in the terms of the POSIX world(三位八进制值).但是,这并没有映射到Windows的工作方式. Windows在用户权限和文件系统之间没有这种紧密耦合. Windows’ OpenFile function甚至没有任何相关参数.但是从我到目
在
Node中,文件模式(例如,对于
fs.open)被定义为
in the terms of the POSIX world(三位八进制值).但是,这并没有映射到Windows的工作方式. Windows在用户权限和文件系统之间没有这种紧密耦合. Windows’
OpenFile function甚至没有任何相关参数.但是从我到目前为止收集的内容来看,它们也没有完全被忽视.
有关如何在Windows上使用节点文件模式的任何解释? 解决方法
看看
the source.看起来他们唯一要做的就是根据文件是否可写来设置FILE_ATTRIBUTE_READONLY.
if (flags & _O_CREAT) { if (!((req->mode & ~current_umask) & _S_IWRITE)) { attributes |= FILE_ATTRIBUTE_READONLY; } } 关于fs.chmod的注释也很有趣. /* Todo: st_mode should probably always be 0666 for everyone. We might also * want to report 0777 if the file is a .exe or a directory. * * Currently it's based on whether the 'readonly' attribute is set,which * makes little sense because the semantics are so different: the 'read-only' * flag is just a way for a user to protect against accidental deleteion,and * serves no security purpose. Windows uses ACLs for that. * * Also people now use uv_fs_chmod() to take away the writable bit for good * reasons. Windows however just makes the file read-only,which makes it * impossible to delete the file afterwards,since read-only files can't be * deleted. * * IOW it's all just a clusterfuck and we should think of something that * makes slighty more sense. * * And uv_fs_chmod should probably just fail on windows or be a total no-op. * There's nothing sensible it can do anyway. */ (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- 如何确定dll文件是使用Delphi还是Lazarus编译为x64或x86位
- 我可以在Microsoft Hyper-v虚拟机中运行Android Studio(And
- Windows – 程序如何删除自己的可执行文件
- .net – Windows Azure Worker角色没有超过第一行代码
- cnpm安装过程中提示optional install error: Package requi
- Win10 JDK 环境变量配置
- wix – 自定义操作中的条件
- 打开一个文件夹,并使用WPF突出显示一个特定的文件
- Windows Of CCPC
- Windows Server 2012 R2(Hyper-V VM) – 随机BSOD
推荐文章
站长推荐
热点阅读