博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Android实例-路径信息及文件和文件夹的操作(XE8+小米2)
阅读量:6243 次
发布时间:2019-06-22

本文共 5065 字,大约阅读时间需要 16 分钟。

 

结果:

GetTempFileName:/storage/sdcard0/Android/data/com.embarcadero.Project1/files/tmp/tmp.iQIip24407

GetTempPath:/storage/sdcard0/Android/data/com.embarcadero.Project1/files/tmp

GetHomePath:/data/data/com.embarcadero.Project1/files

GetDocumentsPath:/data/data/com.embarcadero.Project1/files

GetSharedDocumentsPath:/storage/sdcard0/Android/data/com.embarcadero.Project1/files

GetLibraryPath:/data/data/com.embarcadero.Project1/lib

GetCachePath:/data/data/com.embarcadero.Project1/cache

GetPathRoot:/

GetPublicPath:/storage/sdcard0/Android/data/com.embarcadero.Project1/files

GetPicturesPath:/storage/sdcard0/Android/data/com.embarcadero.Project1/files/Pictures

GetSharedPicturesPath:/storage/sdcard0/Pictures

GetCameraPath:/storage/sdcard0/Android/data/com.embarcadero.Project1/files/DCIM

GetSharedCameraPath:/storage/sdcard0/DCIM

GetMusicPath:/storage/sdcard0/Android/data/com.embarcadero.Project1/files/Music

GetSharedMusicPath:/storage/sdcard0/Music

GetMoviesPath:/storage/sdcard0/Android/data/com.embarcadero.Project1/files/Movies

GetAlarmsPath:/storage/sdcard0/Android/data/com.embarcadero.Project1/files/Alarms

GetSharedAlarmsPath:/storage/sdcard0/Alarms

GetDownloadsPath:/storage/sdcard0/Android/data/com.embarcadero.Project1/files/Download

GetSharedDownloadsPath:/storage/sdcard0/Download

GetRingtonesPath:/storage/sdcard0/Android/data/com.embarcadero.Project1/files/Ringtones

GetSharedRingtonesPath:/storage/sdcard0/Ringtones

 

1 unit Unit1;  2   3 interface  4   5 uses  6   System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,  7   FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.ScrollBox,  8   FMX.Memo, FMX.Controls.Presentation, FMX.StdCtrls;  9  10 type 11   TForm1 = class(TForm) 12     Button1: TButton; 13     Memo1: TMemo; 14     Button2: TButton; 15     Button3: TButton; 16     Button4: TButton; 17     Button5: TButton; 18     procedure Button1Click(Sender: TObject); 19     procedure Button2Click(Sender: TObject); 20     procedure Button3Click(Sender: TObject); 21     procedure Button4Click(Sender: TObject); 22     procedure Button5Click(Sender: TObject); 23   private 24     {
Private declarations } 25 public 26 {
Public declarations } 27 end; 28 29 var 30 Form1: TForm1; 31 32 implementation 33 uses 34 System.IoUtils; 35 {
$R *.fmx} 36 {
$R *.NmXhdpiPh.fmx ANDROID} 37 38 procedure TForm1.Button1Click(Sender: TObject); 39 begin 40 Memo1.Lines.Clear; 41 Memo1.Lines.Add('GetTempFileName:' + TPath.GetTempFileName); 42 Memo1.Lines.Add('GetTempPath:' + TPath.GetTempPath); 43 Memo1.Lines.Add('GetHomePath:' + TPath.GetHomePath); 44 Memo1.Lines.Add('GetDocumentsPath:' + TPath.GetDocumentsPath); 45 Memo1.Lines.Add('GetSharedDocumentsPath:' + TPath.GetSharedDocumentsPath); 46 Memo1.Lines.Add('GetLibraryPath:' + TPath.GetLibraryPath); 47 Memo1.Lines.Add('GetCachePath:' + TPath.GetCachePath); 48 Memo1.Lines.Add('GetPathRoot:' + TPath.GetPathRoot(TPath.GetCachePath)); 49 Memo1.Lines.Add('GetPublicPath:' + TPath.GetPublicPath); 50 Memo1.Lines.Add('GetPicturesPath:' + TPath.GetPicturesPath); 51 Memo1.Lines.Add('GetSharedPicturesPath:' + TPath.GetSharedPicturesPath); 52 Memo1.Lines.Add('GetCameraPath:' + TPath.GetCameraPath); 53 Memo1.Lines.Add('GetSharedCameraPath:' + TPath.GetSharedCameraPath); 54 Memo1.Lines.Add('GetMusicPath:' + TPath.GetMusicPath); 55 Memo1.Lines.Add('GetSharedMusicPath:' + TPath.GetSharedMusicPath); 56 Memo1.Lines.Add('GetMoviesPath:' + TPath.GetMoviesPath); 57 Memo1.Lines.Add('GetAlarmsPath:' + TPath.GetAlarmsPath); 58 Memo1.Lines.Add('GetSharedAlarmsPath:' + TPath.GetSharedAlarmsPath); 59 Memo1.Lines.Add('GetDownloadsPath:' + TPath.GetDownloadsPath); 60 Memo1.Lines.Add('GetSharedDownloadsPath:' + TPath.GetSharedDownloadsPath); 61 Memo1.Lines.Add('GetRingtonesPath:' + TPath.GetRingtonesPath); 62 Memo1.Lines.Add('GetSharedRingtonesPath:' + TPath.GetSharedRingtonesPath); 63 end; 64 65 procedure TForm1.Button2Click(Sender: TObject); 66 begin 67 if TFile.Exists(TPath.GetTempFileName) then 68 begin 69 Memo1.Lines.Clear; 70 Memo1.Lines.Add('存在'); 71 end; 72 end; 73 74 procedure TForm1.Button3Click(Sender: TObject); 75 begin 76 if not TDirectory.Exists(TPath.GetTempPath + 'NewDirectory') then 77 TDirectory.CreateDirectory(TPath.GetTempPath + 'NewDirectory'); 78 end; 79 80 procedure TForm1.Button4Click(Sender: TObject); 81 var 82 sFile1: string; 83 sFile2: string; 84 begin 85 sFile1 := TPath.GetTempPath + '123.jpg'; 86 sFile2 := TPath.GetTempPath + '456.jpg'; 87 if not TFile.Exists(sFile1) then 88 begin 89 TFile.Copy(sFile1, sFile2); 90 end; 91 end; 92 93 procedure TForm1.Button5Click(Sender: TObject); 94 var 95 Files: TStringDynArray; 96 I: Integer; 97 begin 98 if TDirectory.Exists(TPath.GetTempPath + '/temp/') then 99 begin100 Files := TDirectory.GetFiles(TPath.GetTempPath + '/temp/');101 for I := 0 to high(Files) do102 begin103 TFile.Delete(Files[I]);104 end;105 end;106 end;107 108 end.

 

转载地址:http://iasia.baihongyu.com/

你可能感兴趣的文章
利用GPU实现翻页效果
查看>>
C# 中的await
查看>>
java以流的形式输出文件
查看>>
『PyTorch』第十三弹_torch.nn.init参数初始化
查看>>
linux 查找目录下的文件内容并替换(批量)
查看>>
iphone遮住听筒/感应器/摄像头黑屏的解决办法
查看>>
python 抓取alexa数据
查看>>
UART、SPI和I2C详解
查看>>
兼容N多浏览器的CSS阴影效果
查看>>
Multiple arguments in Django template filters
查看>>
ARM11-Linux2.6-Button-Driver-Base-info
查看>>
抽屉Panel的研究
查看>>
In-App Purchase
查看>>
深圳it公司
查看>>
glog 使用中存在的问题
查看>>
WCF, the Service attribute value in the ServiceHost directive could not be found.
查看>>
Scriptcase价格调整(五折销售)
查看>>
【转】 编写C#调用的C++DLL
查看>>
Programming Concepts
查看>>
【Linux】用grep在文档中查找内容
查看>>