问题
I have a Delphi app (D2010) which lets the user select a JPG file via an OpenDialog. When I select the file from a normal Windows directory, my TOpenDialog.Filename contains the FULL PATH to the file, and my code works. The issue I am running into is that the user will often be copying the file phone a cell phone. When the user plugs in the phone, runs my code, the TOpenDialog Shows the files on the cell phone, the user picks the proper jpg file, but the TOenDialog.Filename does NOT contain the path to the file (only the name of the file), so my program cannot find the file.
For both CAMERAS and CELL PHONES, the picture directory is the DCIM directory. For whatever reason, Windows 7 and probably all others, does NOT provide a drive letter to this directory. As such TOpenDialog only returns the file name, not the full path name. This means I cannot copy the file since I don't have a full path name.
So in short, my question is: How do I use TOpenDialog to get the full path name, when the path is a storage area on a cell phone (in my case, iPhone 5). XE5 has a routine called GetCameraPath, but D2010 does not.
来源:https://stackoverflow.com/questions/20442747/delphi-how-to-get-directory-with-opendialog-using-iphone-as-a-picture-source