Delphi extracts all IO-related elements into the system.ioutils unit.
It is convenient to use the Tpath method for path operation.
Uses System.ioutils
tpath.gettemppath//Temp Directory
tpath.getcamerapath//Camera Catalogue (Photo/video)
tpath.getmusicpath//Music Catalogue
tpath.getdownloadspath//Download Catalogue
......
If you use static methods of the Tpath class then the code is cross-platform and can be used on windows,mac,ios,android. If only the operation of Android can also use the Androidapi.ioutils unit of those getxx functions, it is very simple, there are no parameters, and the return value is a string.
You can test with any one of these events:
ShowMessage (' GetCachePath: ' + tpath.getpathroot (Tpath.getcachepath));
ShowMessage (' GetTempPath: ' + tpath.gettemppath);
ShowMessage (' Gethomepath: ' + tpath.gethomepath);
ShowMessage (' Getdocumentspath: ' + tpath.getdocumentspath); ShowMessage (' Getshareddocumentspath: ' + tpath.getshareddocumentspath);
ShowMessage (' Getsharedpicturespath: ' + tpath.getsharedpicturespath);
ShowMessage (' Getshareddownloadspath: ' + tpath.getshareddownloadspath);
ShowMessage (' GetCachePath: ' + tpath.getcachepath);
ShowMessage (' Getcamerapath: ' + tpath.getcamerapath);
ShowMessage (' Getpicturespath: ' + tpath.getpicturespath);
ShowMessage (' Getpublicpath: ' + tpath.getpublicpath);
Here are the results of the Nubia Z5 Phone test (all functions under Tpath, none at all):
GetRandomFileName:L8d4hdw0.W2d
gettempfilename:/storage/sdcard0/android/data/com.embarcadero.project1/files/tmp/tmp.qqvwf21410
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/app-lib/com.embarcadero.project1-2
Getcachepath:/data/data/com.embarcadero.project1/cache
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
Delphi FMX Mobile Directory extraction, the IO related to the extraction into the system.ioutils unit