Android实例-路径信息及文件和文件夹的操作(XE8+小米2)

结果:
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
unit Unit1; interface uses
System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.ScrollBox,
FMX.Memo, FMX.Controls.Presentation, FMX.StdCtrls; type
TForm1 = class(TForm)
Button1: TButton;
Memo1: TMemo;
Button2: TButton;
Button3: TButton;
Button4: TButton;
Button5: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
procedure Button5Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end; var
Form1: TForm1; implementation
uses
System.IoUtils;
{$R *.fmx}
{$R *.NmXhdpiPh.fmx ANDROID} procedure TForm1.Button1Click(Sender: TObject);
begin
Memo1.Lines.Clear;
Memo1.Lines.Add('GetTempFileName:' + TPath.GetTempFileName);
Memo1.Lines.Add('GetTempPath:' + TPath.GetTempPath);
Memo1.Lines.Add('GetHomePath:' + TPath.GetHomePath);
Memo1.Lines.Add('GetDocumentsPath:' + TPath.GetDocumentsPath);
Memo1.Lines.Add('GetSharedDocumentsPath:' + TPath.GetSharedDocumentsPath);
Memo1.Lines.Add('GetLibraryPath:' + TPath.GetLibraryPath);
Memo1.Lines.Add('GetCachePath:' + TPath.GetCachePath);
Memo1.Lines.Add('GetPathRoot:' + TPath.GetPathRoot(TPath.GetCachePath));
Memo1.Lines.Add('GetPublicPath:' + TPath.GetPublicPath);
Memo1.Lines.Add('GetPicturesPath:' + TPath.GetPicturesPath);
Memo1.Lines.Add('GetSharedPicturesPath:' + TPath.GetSharedPicturesPath);
Memo1.Lines.Add('GetCameraPath:' + TPath.GetCameraPath);
Memo1.Lines.Add('GetSharedCameraPath:' + TPath.GetSharedCameraPath);
Memo1.Lines.Add('GetMusicPath:' + TPath.GetMusicPath);
Memo1.Lines.Add('GetSharedMusicPath:' + TPath.GetSharedMusicPath);
Memo1.Lines.Add('GetMoviesPath:' + TPath.GetMoviesPath);
Memo1.Lines.Add('GetAlarmsPath:' + TPath.GetAlarmsPath);
Memo1.Lines.Add('GetSharedAlarmsPath:' + TPath.GetSharedAlarmsPath);
Memo1.Lines.Add('GetDownloadsPath:' + TPath.GetDownloadsPath);
Memo1.Lines.Add('GetSharedDownloadsPath:' + TPath.GetSharedDownloadsPath);
Memo1.Lines.Add('GetRingtonesPath:' + TPath.GetRingtonesPath);
Memo1.Lines.Add('GetSharedRingtonesPath:' + TPath.GetSharedRingtonesPath);
end; procedure TForm1.Button2Click(Sender: TObject);
begin
if TFile.Exists(TPath.GetTempFileName) then
begin
Memo1.Lines.Clear;
Memo1.Lines.Add('存在');
end;
end; procedure TForm1.Button3Click(Sender: TObject);
begin
if not TDirectory.Exists(TPath.GetTempPath + 'NewDirectory') then
TDirectory.CreateDirectory(TPath.GetTempPath + 'NewDirectory');
end; procedure TForm1.Button4Click(Sender: TObject);
var
sFile1: string;
sFile2: string;
begin
sFile1 := TPath.GetTempPath + '123.jpg';
sFile2 := TPath.GetTempPath + '456.jpg';
if not TFile.Exists(sFile1) then
begin
TFile.Copy(sFile1, sFile2);
end;
end; procedure TForm1.Button5Click(Sender: TObject);
var
Files: TStringDynArray;
I: Integer;
begin
if TDirectory.Exists(TPath.GetTempPath + '/temp/') then
begin
Files := TDirectory.GetFiles(TPath.GetTempPath + '/temp/');
for I := to high(Files) do
begin
TFile.Delete(Files[I]);
end;
end;
end; end.
Android实例-路径信息及文件和文件夹的操作(XE8+小米2)的更多相关文章
- Android实例-使用电话拨号器在移动设备上(官方)(XE8+小米2)
源文地址: http://docwiki.embarcadero.com/RADStudio/XE5/en/Mobile_Tutorial:_Using_the_Phone_Dialer_on_Mob ...
- Android的路径信息[转]
Delphi早就把IO相关的都提取到System.IoUtils单元中了. 路径操作就使用TPath的方法都很方便.usesSystem.IoUtilsTPath.GetTempPath//临时目录T ...
- Delphi处理Android的路径信息
路径操作就使用TPath的方法都很方便.usesSystem.IoUtilsTPath.GetTempPath//临时目录TPath.GetCameraPath//照相机目录(照片/录像)TPath. ...
- matlab 重命名文件和文件夹
1.查看文件存在 dir() 若存在,返回文件信息 dir(‘test.txt’) %查看当前目录是否存在test.txt文件 dir(‘C:\test.txt’) %查看指定目录是否存在 ...
- Android根据文件路径使用File类获取文件相关信息
Android通过文件路径如何得到文件相关信息,如 文件名称,文件大小,创建时间,文件的相对路径,文件的绝对路径等: 如图: 代码: public class MainActivity extends ...
- C# 对包含文件或目录路径信息的 System.String 实例执行操作
在字符串操作中有一类比较特殊的操作,就是对包含文件或目录路径信息的 System.String 实例执行操作.比如根据一个表示路径的字符串获取其代表的文件名称.文件夹路径.文件扩展名等.在很多时候,我 ...
- android--------根据文件路径使用File类获取文件相关信息
Android通过文件路径如何得到文件相关信息,如 文件名称,文件大小,创建时间,文件的相对路径,文件的绝对路径等. 如图: public class MainActivity extends Act ...
- 使用任意的输入流(InputStream)实例,包括字符串形式的文件路径或者 file:// 的 URL 形式的文件路径来配置
mybatis – MyBatis 3 | 入门 http://www.mybatis.org/mybatis-3/zh/getting-started.html 从 XML 中构建 SqlSessi ...
- Android学习路径(两)项目文件本身使用场景和文件演示
ios讨论群1群:135718460 1.src文件:java源码存放文件夹 2.gen 文件:自己主动生成全部由android开发工具自己主动生成的文件,文件夹中最重要的就是R.java文件,这个 ...
随机推荐
- ANDROID_MARS学习笔记_S01_012_RatingBar
1.xml <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns: ...
- photoshop:模仿-广告放射背景
模仿对象:图片大小960*400 过程: 1.新建文档,大小为:960*800 2.选择渐变工具,黑白从上往下渐变 3.滤镜->扭曲->波浪,参考设置 4.滤镜->扭曲->极坐 ...
- 新建arcgis api for android 项目失败
新建ArcGIS Project for Android项目失败解决方案 - skybot的专栏 - 博客频道 - CSDN.NET http://blog.csdn.net/daonidedie/a ...
- 编程之美 3.1 字符串移位包含问 复杂度(O(N*K)
分享关于编程之美3.1自己编写的代码,很简单. s2.沿着s1匹配(循环匹配,利用%Length技巧),匹配上,返回true. //BOP3.1 char src[] = "AABBCD&q ...
- unite
列出某个集合里的项目,比如file,buffer等 :United file——列出文件 :United buffer——列出buffer :United file_rec——递归列出文件 进入Uni ...
- 在XML里的XSD和DTD以及standalone的使用
有关XML结构中的XSD和DTD以及standalone的使用 XmlDeclaration declare= document.CreateXmlDeclaration("1.0" ...
- 需要保存数据zabbix,不需要保存数据nagios
需要保存数据zabbix,不需要保存数据nagios cacti 有什么好用的基于Web的Linux系统监控开源工具(网管系统) 要求类似于Ubuntu的Landscape,可以记录下历史CPU数值. ...
- 初探数位dp
数位dp有着很明显的特点,一般来说是给定区间[l,r]求满足某种条件区间中的数有多少个 朴素解法一般是O(n)的而n往往很大(10^8起步) 这时候我们就要想办法优化,于是就有了数位dp 数位有两个基 ...
- poj3186 poj3267
两道很不错的dp 3186很神似回文词,合并石子之类的问题: 一开始不知道怎么在dp方程中体现权值天数,很来才想起来 对于一段区间[i,j],里面的东西必然是要卖完的 又因为只能从两头开始卖,所以 d ...
- bzoj2431:[HAOI2009]逆序对数列
单组数据比51nod的那道题还弱...而且连优化都不用了.. #include<cstdio> #include<cstring> #include<cctype> ...