locked
KnownFolders::MusicLibrary::Path returns 0(NULL)!

    Question

  • Hi,

    I want to get a full path to the standard music library. I call the member function Path on KnownFolders::MusicLibrary, but get a 0(NULL). My code:

    auto spMusic = KnownFolders::MusicLibrary;

    auto csPath = csMusic->Path;

    // csPath is nullptr!

    Do I do that wrong or there is other way to do that?

    Please help.

    Thanks AnryNet

    Monday, March 5, 2012 9:32 AM

Answers

  • The Library is not a file system object and doesn't have a path, so the nullptr return is expected. If you iterate over the folders within the library they may be file system objects and have paths or they may be other shell objects and not have paths.

    What are you trying to do with this?

    Even if you can get the path, your app won't be able to access it. Your app can only directly access locations within its own app data. For other locations which are enabled via capabilities or pickers the app receives the data from the runtime broker via a stream from the StorageFile object. Like with libraries, this data may not be backed from the file system. For example, it could be provided from an app which implements the App to App Picking contract.

    --Rob

    • Marked as answer by AnryNetToo Monday, March 5, 2012 2:25 PM
    Monday, March 5, 2012 9:50 AM
    Owner