DELPHI盒子
!实时搜索: 盒子论坛 | 注册用户 | 修改信息 | 退出
检举帖 | 全文检索 | 关闭广告 | 捐赠
技术论坛
 用户名
 密  码
自动登陆(30天有效)
忘了密码
≡技术区≡
DELPHI技术
lazarus/fpc/Free Pascal
移动应用开发
Web应用开发
数据库专区
报表专区
网络通讯
开源项目
论坛精华贴
≡发布区≡
发布代码
发布控件
文档资料
经典工具
≡事务区≡
网站意见
盒子之家
招聘应聘
信息交换
论坛信息
最新加入: tg567
今日帖子: 10
在线用户: 14
导航: 论坛 -> DELPHI技术 斑竹:liumazi,sephil  
作者:
男 delphi2022 (fmuser) ▲△△△△ -
普通会员
2022/1/18 4:33:14
标题:
向Mac系统的/library资源库文件夹写文件权限问题 浏览:730
加入我的收藏
楼主: 请教各位,delphi做的macOS下的app,无法向系统的/library资源库文件夹写入文件,应该是权限的问题,请问各位有解决办法吗,能否赐一段代码;是向系统的资源库文件夹写文件,不是用户的资源库
----------------------------------------------
-
作者:
男 nevergrief (孤独骑士) ★☆☆☆☆ -
盒子活跃会员
2022/1/18 5:21:08
1楼: 用sudo运行你的程序即可,不存在用代码提权的方法
----------------------------------------------
只有偏执狂才能生存!
作者:
男 emailx45 (emailx45) ▲▲▲▲△ -
普通会员
2022/1/18 8:46:50
2楼: you can try save your files in "User folder"

using the TPATH (System.IOUtils.TPath... many functions for all platforms) you can know where each user can save your files or use shared folder for all users.

zzzzSaveMyFilesIn := TPath.Combine(TPath.GetLibraryPath,'Application Support');


Or, retrieving it directly from iOS or OSX: (For Delphi XE8 and higher)

uses
     Macapi.Helpers,
     {$IFDEF iOS}
     iOSapi.Foundation,
     {$ENDIF}
     {$IFDEF OSX}
     Macapi.Foundation,
     {$ENDIF}

     System.IOUtils;

function GetApplicationSupportDir : string;

var
   Paths : NSArray;
   Dir : NSString;

begin
   // For "Application Support" under the User's Library directory:
   Paths := TNSArray.Wrap(NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, True));

   // For "Application Support" under the System Library directory:
   //Paths := TNSArray.Wrap(NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSSystemDomainMask, True));


   Dir := TNSString.Wrap(Paths.objectAtIndex(0));

   Result := NSStrToStr(Dir);
end;
----------------------------------------------
The higher the degree, the greater the respect given to the humblest!RAD 11.3
作者:
男 delphi2022 (fmuser) ▲△△△△ -
普通会员
2022/1/19 1:54:42
3楼: 请问有没有代码提权的办法,向系统的资源库文件夹写文件
----------------------------------------------
-
信息
登陆以后才能回复
Copyright © 2CCC.Com 盒子论坛 v3.0.1 版权所有 页面执行66.40625毫秒 RSS