1

Im using the FileOpenPicker to let the User choose a file (sqlite-db), which can be anywhere on the computer:

public async Task<string> PickDb()
{
    Windows.Storage.StorageFile file = null;
    var picker = new FileOpenPicker();
    picker.FileTypeFilter.Add(".sqlite");                 
    file = await picker.PickSingleFileAsync();
    if (file != null)
        return file.Path;
    else
        return string.empty;
}

This filename is then passed over to sqlite to open a sqlite-connection.

So if the sqlite-file is in the apps home directory, the sqlite-connection is properly opened. If the file is somewhere else, the sqlite-connection gives an read-error.

I know, that UWP-Apps have limited acces to the the filesystem. but as far as I understood, a file returned by a FileOpenPicker, which was manually picked by the user, has always read-write rights.

Where am I wrong?

4
  • 1
    But in your case you're using the path of the file. Use the direct reference to the file don't try accessing via its path, this is why you're getting an error Commented Jun 17, 2016 at 21:16
  • I must, because the sqlite-api needs the path as string. Commented Jun 17, 2016 at 21:25
  • What error are you exactly getting? Commented Jun 17, 2016 at 21:31
  • var r = SQLite3.Open(databasePath, out handle, (int)openFlags, IntPtr.Zero); r is SQLite3.Result.CannotOpen Commented Jun 17, 2016 at 22:08

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.