手机路径、Windows路径知识及delphiXE跨设备APP自动下载和升级

本文详细解析了Windows、Android、iOS和MAC等不同操作系统下,TPath类的使用方法,介绍了各种路径的获取方式及其特点。同时,深入探讨了Android和iOS的权限体系,帮助开发者更好地理解和管理跨平台APP的文件存取与权限控制。

手机路径、Windows路径知识

及delphiXE跨设备APP自动下载和升级

一、APP安装程序文件版本和权限信息

1、运行时动态调用Android apk的AndroidManifest.xml获取versionName

2、运行时动态调用IOS ipa的info.plist获取CFBundleVersion

          (和entitlements)

uses iOSapi.Foundation;

  NSBundle = interface;  //:包接口

  NSDictionary = interface;  //:目录接口

  NSFileManager = interface;  //:文件管理员接口

  NSFileVersion = interface;   //:文件版本接口

 

二、TPath手机和电脑的存取路径

(一)、WINDOWS电脑设备

TPath.GetDirectoryName(Filename)参数MSWINDOWS存取位置:C:\Users\Administrator\AppData\Local
TPath.GetExtension(Filename)参数MSWINDOWS存取位置:.pdf
TPath.GetFileName(Filename)参数MSWINDOWS存取位置:NO.XSKD20150304048.pdf
TPath.GetFileNameWithoutExtension(Filename)参数MSWINDOWS存取位置:NO.XSKD20150304048
TPath.GetFullPath(TPath.GetDownloadsPath)参数MSWINDOWS存取位置:C:\Users\Administrator\AppData\Local
TPath.GetPathRoot(TPath.GetDownloadsPath)参数MSWINDOWS存取位置:C:\
TPath.GetRandomFileName参数MSWINDOWS存取位置:37CdIVK5.88J


TPath.GetTempFileName参数MSWINDOWS存取位置:C:\Users\Administrator\AppData\Local\Temp\tmpBF5B.tmp
TPath.GetTempPath参数MSWINDOWS存取位置:C:\Users\Administrator\AppData\Local\Temp\
TPath.GetHomePath参数MSWINDOWS存取位置:C:\Users\Administrator\AppData\Roaming
TPath.GetDocumentsPath参数MSWINDOWS存取位置:C:\Users\Administrator\Documents
TPath.GetSharedDocumentsPath参数MSWINDOWS存取位置:C:\Users\Public\Documents


TPath.GetLibraryPath参数MSWINDOWS存取位置:D:\Http上传下载\IdHttp下载文件断点续传\Win64\Debug\


TPath.GetCachePath参数MSWINDOWS存取位置:C:\Users\Administrator\AppData\Local
TPath.GetPublicPath参数MSWINDOWS存取位置:C:\ProgramData
TPath.GetPicturesPath参数MSWINDOWS存取位置:C:\Users\Administrator\Pictures
TPath.GetSharedPicturesPath参数MSWINDOWS存取位置:C:\Users\Public\Pictures
TPath.GetCameraPath参数MSWINDOWS存取位置:C:\Users\Administrator\Pictures
TPath.GetSharedCameraPath参数MSWINDOWS存取位置:C:\Users\Public\Pictures
TPath.GetMusicPath参数MSWINDOWS存取位置:C:\Users\Administrator\Music
TPath.GetSharedMusicPath参数MSWINDOWS存取位置:C:\Users\Public\Music
TPath.GetMoviesPath参数MSWINDOWS存取位置:C:\Users\Administrator\Videos
TPath.GetSharedMoviesPath参数MSWINDOWS存取位置:C:\Users\Public\Videos
TPath.GetAlarmsPath参数MSWINDOWS存取位置:C:\Users\Administrator\Music
TPath.GetSharedAlarmsPath参数MSWINDOWS存取位置:C:\Users\Public\Music
TPath.GetDownloadsPath参数MSWINDOWS存取位置:C:\Users\Administrator\AppData\Local
TPath.GetSharedDownloadsPath参数MSWINDOWS存取位置:C:\ProgramData
TPath.GetRingtonesPath参数MSWINDOWS存取位置:C:\Users\Administrator\Music
TPath.GetSharedRingtonesPath参数MSWINDOWS存取位置:C:\Users\Public\Music
TPath.GetRingtonesPath参数MSWINDOWS存取位置:C:\Users\Administrator\Music

(二)、Android手机、平板、安卓笔记本等设备

     概念:

     /storage/emulated/0/ :安卓指"内部存储"  :可以在安卓的存取权限设置并获取后,进行读写

     /storage/emulated/1/ :安卓指SDCard(“SD卡”):可以在安卓的存取权限设置并获取后,进行读写

    //:::以下对上述规则均适用:::

      //1、你的APP的包全路径名:比如:com.pulledup.mainPro  ,你的APP的包名:mainPro,即package

        //: 包(即应用程序Apk)存取路径:   /data/user/0/包全路径名/

        //: 包(即应用程序Apk)的xml配置文件存取路径:   /内部存储/Addroid/data/包全路径名/files

         App路径:/data/user/0/com.pulledup.mainPro/   //:并非你的App运行时对外存取路径,不可见:

         伴随应用打包时就一起分发文件出去供所有用户user都可以在APP中读取这些文件的APP的内部路径,不可见:即.\assets\internal\   ,即TPath.GetHomePath参数Android存取位置:/data/user/0/com.embarcadero.MainPro/files ,这个路径下的文件:它是emulated  //:仿真的  :获得权限后可读但不可写,除非你将文件在代码开发阶段,就伴随应用Deployment将其分发到.\assets\internal后,才能对该文件可读可写,而无需任何权限(包括存储权限)。

         安卓路径由TJStorageManager进行管理:为以上的JNI析构后拼接路径:仿真路径,和Windows不一个概念!


      //1.1、存取位置GetSharedDownloadsPath参数:(获取共享下载路径:获得权限后可读可写
        //:  /内部存储/Download/NO.XSKD20150304048.pdf


      //1.2、存取位置GetDownloadsPath参数:(获取应用程序的文件下载路径:获得权限后可读可写
        //:  /内部存储/Addroid/data/包全路径名/files/Download/NO.XSKD20150304048.pdf

 

TPath.GetDirectoryName(Filename)参数Android存取位置:/storage/emulated/0/Android/data/com.embarcadero.MainPro/files/Download
TPath.GetExtension(Filename)参数Android存取位置:.pdf
TPath.GetFileName(Filename)参数Android存取位置:NO.XSKD20150304048.pdf
TPath.GetFileNameWithoutExtension(Filename)参数Android存取位置:NO.XSKD20150304048
TPath.GetFullPath(TPath.GetDownloadsPath)参数Android存取位置:/storage/emulated/0/Android/data/com.embarcadero.MainPro/files/Download
TPath.GetPathRoot(TPath.GetDownloadsPath)参数Android存取位置:/
TPath.GetRandomFileName参数Android存取位置:hS1s1veL.GN3


TPath.GetTempFileName参数Android存取位置:/storage/emulated/0/Android/data/com.embarcadero.MainPro/files/tmp/tmp.szyus65J6O
TPath.GetTempPath参数Android存取位置:/storage/emulated/0/Android/data/com.embarcadero.MainPro/files/tmp :获得权限后可读可写

TPath.GetLibraryPath参数Android存取位置:/data/app/com.embarcadero.MainPro-1/lib/arm  获得权限后可读但不可写
TPath.GetCachePath参数Android存取位置:/data/user/0/com.embarcadero.MainPro/cache  获得权限后可读但不可写

TPath.GetHomePath参数Android存取位置:/data/user/0/com.embarcadero.MainPro/files  //:伴随应用打包时就一起分发文件出去供所有用户user都可以在APP中读取这些文件的APP的内部路径,不可见:即.\assets\internal。TPath.GetHomePath参数Android存取位置:/data/user/0/com.embarcadero.MainPro/files ,这个路径下的文件:它是emulated  //:仿真的  :可读可写路径,除非你将文件在代码开发阶段,就伴随应用Deployment将其分发到.\assets\internal后,才能对该文件可读可写,而无需任何权限(包括存储权限):
TPath.GetDocumentsPath参数Android存取位置:/data/user/0/com.embarcadero.MainPro/files //:伴随应用打包时就一起分发文件出去供所有用户user都可以在APP中读取这些文件的APP的内部路径,不可见:即.\assets\internal。其权限特征和GetHomePath类似:

 

TPath.GetSharedDocumentsPath参数Android存取位置:/storage/emulated/0/Documents 

获得权限后可读可写,并且持久,除非机主专业并使用手机助手删除或重置初始化手机,否则永远不会被删除


TPath.GetPublicPath参数Android存取位置:/storage/emulated/0/Android/data/com.embarcadero.MainPro/files //:App的对外可见可存取的文件目录的公开路径  

获得权限后可读可写,但其数据可被机主从【设置-应用管理-该应用-存储-删除数据】中清除路径/storage/emulated/0/Android/data/com.embarcadero.MainPro而使其中数据同时消失


TPath.GetPicturesPath参数Android存取位置:/storage/emulated/0/Android/data/com.embarcadero.MainPro/files/Pictures
TPath.GetSharedPicturesPath参数Android存取位置:/storage/emulated/0/Pictures
TPath.GetCameraPath参数Android存取位置:/storage/emulated/0/Android/data/com.embarcadero.MainPro/files/DCIM

获得权限后可读可写

TPath.GetSharedCameraPath参数Android存取位置:/storage/emulated/0/DCIM

获得权限后可读可写,以下均可读写:


TPa

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

专讲冷知识

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值