请不要把登入信息保存在可执行文件相同目录下!!!
1. 你使用的BBDown版本是什么?(指明 Release / Actions / DotnetTool)
1.6.2 ,用的AUR里的bbdown-git r498.fb3c0b6-1
2. 你在什么系统使用本软件?(Win/Linux/Mac)
Linux archlinux 6.9.9-arch1-1 #1 SMP PREEMPT_DYNAMIC Fri, 12 Jul 2024 00:06:53 +0000 x86_64 GNU/Linux
3. 你使用的完整命令是什么?
BBDown login
4. 遇到了什么问题?
安装后可执行文件在/usr/bin/BBDown
在成功登入后,因普通用户无权写入/usr/bin,导致登入信息不能保存,出现以下错误
[2024-07-14 12:24:39.179] - UnauthorizedAccess_IODenied_Path, /usr/bin/BBDown.data
后来用了命令sudo chmod 777 /usr/bin/BBDown.data才临时解决了这个问题,但总感觉这样不舒服
我的建议是保存在用户的home目录下,比如~/.config/BBDown。
5. 运行截图(最好开启--debug;注意自行将Cookie/Token等敏感信息隐藏)
好像不是在执行文件目录下,而是当前目录,你cd到其他目录运行就好,不要直接在安装目录下运行
对于非Windows用户来说确实是个问题,后续准备放到家目录去
你就不该把BBDown 文件放到/usr/bin 目录下
So, according to you, the problem will be solved if it's placed in the /usr/local/bin/ directory? Definitely no!
For Linux and macOS versions, the UNIX conventions should be followed.
You should adhere your application to the XDG Base Directory Specification.
Your application should store and load data and configuration files to/from the directories pointed by the following environment variables:
-
$XDG_CONFIG_HOME (default:
$HOME/.config): user-specific configuration files. -
$XDG_DATA_HOME (default:
$HOME/.local/share): user-specific data files.
/usr/bin是标准的可执行文件路径,没理由不把程序放在这里
请遵守 XDG 规范,把配置文件放在$XDG_CONFIG_HOME(默认$HOME/.config)里,把数据放在$XDG_DATA_HOME(默认$HOME/.local/share)里,这不仅优雅,且符合规范,更不会遇到任何权限问题
哪怕是在 Windows 上,程序放在某些特权目录中的时候,也会无法写入当前目录(就像#1045,虽然我不确定那是否是由权限引起的),规范化路径永远是一个好的选择,而不是粗暴地放在程序目录下