Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

请为文件写入操作加入判断目标磁盘空间是否充足 #895

Open
AdminHcat opened this issue Jun 9, 2021 · 2 comments
Open
Labels

Comments

@AdminHcat
Copy link
Contributor

  • 启动器版本:hmcl 3.3.180
  • 操作系统:Windows 10 pro
  • Java 版本:16

请为文件写入操作加入判断目标磁盘空间是否充足,如安装新游戏版本,目标磁盘空间不足可能报错java.io.IOException之类的

@burningtnt
Copy link
Member

可以通过类似于 Files.getFileStore(Path.of("C:/")).getUsableSpace() 的操作来获取剩余空间
但我不确定如何“预估游戏的大小”,这个功能 Glavo 觉得有必要吗? @Glavo

@zty012
Copy link

zty012 commented Jul 6, 2024

可以通过类似于 Files.getFileStore(Path.of("C:/")).getUsableSpace() 的操作来获取剩余空间 但我不确定如何“预估游戏的大小”,这个功能 Glavo 觉得有必要吗? @Glavo

向下载地址发送HEAD请求,响应头中的Content-Length就是文件大小

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants