S60開発・PathInfoクラスで各種フォルダのパスを取得する (2006-03-19)
S60端末では、各種ファイルを格納するための標準のパスが定義されています。例えば、702NKにおいて画像ファイルを格納するパスとしては、本体メモリの場合は"C:\Nokia\Images\"が、メモリーカードの場合は"E:\Images\"が標準のパスとなります。内蔵アプリケーションの「ギャラリー」では、これらのパス以下に存在する画像ファイルが画像リストに表示されます。
これらの定義されている標準のパスを取得するためのAPIとして、PathInfoクラスが提供されています。使い方は非常に簡単で、static関数として用意されているAPIを呼ぶと、パス文字列がconst TDesC&型の戻り値で取得できます。
具体的に取得できる値は以下のようになります(702NKの場合)。それぞれのAPIが何のパスを表しているのかについては、API名を見ればだいたいわかると思います。
| PathInfo API | 戻り値 |
| RomRootPath() | Z:\Nokia\ |
| PhoneMemoryRootPath() | C:\Nokia\ |
| MemoryCardRootPath() | E:\ |
| GamesPath() | Games\ |
| InstallsPath() | Installs\ |
| OthersPath() | Others\ |
| VideosPath() | Videos\ |
| ImagesPath() | Images\ |
| PicturesPath() | Images\Pictures\ |
| GmsPicturesPath() | Images\Pictures\ |
| MmsBackgroundImagesPath() | Images\Backgrounds\ |
| PresenceLogosPath() | Images\Presence\ |
| SoundsPath() | Sounds\ |
| DigitalSoundsPath() | Sounds\Digital\ |
| SimpleSoundsPath() | Sounds\Simple\ |
| ImagesThumbnailPath() | _PAlbTN\ |
| MemoryCardContactsPath() | E:\Others\Contacts\ |
ただし、PathInfoクラスがサポートされているのはS60 2nd Edition以降となります。以前のS60端末に対応したアプリケーションを作成する場合には使用できませんのでご注意ください。