将文件复制到应用程序可能无法写入的目录
我正在编写一个应用程序,目前处于工作流程中:
-File A doesn't exist?
-Copy file B to file A
-Error?
-Copy file B to file A with higher privileges
问题出在“以更高权限将文件 B 复制到文件 A”步骤中。我刚开始向管理员询问他/她的密码。我想要一个与此类似的窗口,管理员可以在其中输入密码,以便将文件复制到其他不可写的位置:
我完全不知道从哪里开始,有人可以帮助我吗?谢谢! :D
I am writing an application and I am at this point at the workflow:
-File A doesn't exist?
-Copy file B to file A
-Error?
-Copy file B to file A with higher privileges
The problem is in the `Copy file B to file A with higher privileges' step. I am new to asking the admin for his/her password. I'd like a window similar to this, where the admin can enter the password so the file can be copied to an otherwise unwritable location:
I have totally no idea where to start, can someone help me out? Thanks! :D
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用 AuthorizationExecuteWithPrivileges()
请参阅此处查看示例 此处获取“OSXSlightlyBetterAuth”的完整代码。
can you use AuthorizationExecuteWithPrivileges()
See here for an example and here for the full code to 'OSXSlightlyBetterAuth'.