Constructing URIs

The are three different allowed ways to build URLs to files and directories:


  • Value of File API system property + own path

    This is the recommended way to build the URLs because this also works in Series 40 and other devices.

    For example

    String url1 = System.getProperty("fileconn.dir.music") + "myDir/theme.mp3";
  • "file:///" + Virtual root + Virtual directory + own path

    For example

    String url2 = "file:///" + "Internal/" + "Music/" + "myDir/theme.mp3";
    
  • physical path name

    For example

    String url3 = "file:///c:/data/music/myDir/theme.mp3";

Mixing physical and virtual roots and directories is not allowed. Trying to use the following URIs causes an exception :

// virtual root and physical directories are mixed, Not OK!!! 
String UrlErr1 = "file:///Internal/data/music/MyDir/theme.mp3";
// physical root and virtual directory are mixed, Not OK!!!
String UrlErr2 = "file:///c:/Music/myDir/theme.mp3"