{"action":"created","comment":{"url":"https://api.github.com/repos/aspnet/Microsoft.Data.Sqlite/pulls/comments/43077895","id":43077895,"diff_hunk":"@@ -90,10 +95,66 @@ public override void Open()\n             var flags = Constants.SQLITE_OPEN_READWRITE | Constants.SQLITE_OPEN_CREATE;\n             flags |= (ConnectionStringBuilder.Cache == SqliteConnectionCacheMode.Shared) ? Constants.SQLITE_OPEN_SHAREDCACHE : Constants.SQLITE_OPEN_PRIVATECACHE;\n \n-            var rc = NativeMethods.sqlite3_open_v2(ConnectionStringBuilder.DataSource, out _db, flags, vfs: null);\n+            var path = AdjustForRelativeDirectory(ConnectionStringBuilder.DataSource);\n+\n+            var rc = NativeMethods.sqlite3_open_v2(path, out _db, flags, vfs: null);\n             MarshalEx.ThrowExceptionForRC(rc, _db);\n             SetState(ConnectionState.Open);\n+\n+            SetFolders();\n+        }\n+\n+#if !NETCORE50\n+        private void SetFolders() { }\n+\n+        private string AdjustForRelativeDirectory(string path)\n+            => path;\n+#else\n+        private string AdjustForRelativeDirectory(string path)\n+        {\n+            var appData = GetApplicationData();\n+            try\n+            {\n+                if (appData == null || appData?.LocalFolder?.Path == null || Path.IsPathRooted(path))\n+                {\n+                    return path;\n+                }\n+\n+                return Path.GetFullPath(Path.Combine(appData.LocalFolder.Path, path));\n+            }\n+            catch (NotSupportedException)\n+            {\n+                Debug.WriteLine(\"Could not adjust relative path for use on UWP.\");\n+            }\n+            return path;\n+        }\n+\n+        private void SetFolders()\n+        {\n+            var appData = GetApplicationData();\n+\n+            if (appData == null)\n+            {\n+                return;\n+            }\n+\n+            using (var command = CreateCommand())\n+            {\n+                command.CommandText = $\"PRAGMA temp_store_directory = '{appData.TemporaryFolder.Path}'\";\n+                command.ExecuteNonQuery();\n+            }","path":"src/Microsoft.Data.Sqlite/SqliteConnection.cs","position":64,"original_position":64,"commit_id":"39b1c038ad2523b08b509f0a4dce929920feebc3","original_commit_id":"39b1c038ad2523b08b509f0a4dce929920feebc3","user":{"login":"bricelam","id":1226749,"avatar_url":"https://avatars.githubusercontent.com/u/1226749?v=3","gravatar_id":"","url":"https://api.github.com/users/bricelam","html_url":"https://github.com/bricelam","followers_url":"https://api.github.com/users/bricelam/followers","following_url":"https://api.github.com/users/bricelam/following{/other_user}","gists_url":"https://api.github.com/users/bricelam/gists{/gist_id}","starred_url":"https://api.github.com/users/bricelam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bricelam/subscriptions","organizations_url":"https://api.github.com/users/bricelam/orgs","repos_url":"https://api.github.com/users/bricelam/repos","events_url":"https://api.github.com/users/bricelam/events{/privacy}","received_events_url":"https://api.github.com/users/bricelam/received_events","type":"User","site_admin":false},"body":"I think there's an existing extension method that does all this","created_at":"2015-10-27T02:16:37Z","updated_at":"2015-10-27T02:16:37Z","html_url":"https://github.com/aspnet/Microsoft.Data.Sqlite/pull/161#discussion_r43077895","pull_request_url":"https://api.github.com/repos/aspnet/Microsoft.Data.Sqlite/pulls/161","_links":{"self":{"href":"https://api.github.com/repos/aspnet/Microsoft.Data.Sqlite/pulls/comments/43077895"},"html":{"href":"https://github.com/aspnet/Microsoft.Data.Sqlite/pull/161#discussion_r43077895"},"pull_request":{"href":"https://api.github.com/repos/aspnet/Microsoft.Data.Sqlite/pulls/161"}}},"pull_request":{"url":"https://api.github.com/repos/aspnet/Microsoft.Data.Sqlite/pulls/161","id":48804537,"html_url":"https://github.com/aspnet/Microsoft.Data.Sqlite/pull/161","diff_url":"https://github.com/aspnet/Microsoft.Data.Sqlite/pull/161.diff","patch_url":"https://github.com/aspnet/Microsoft.Data.Sqlite/pull/161.patch","issue_url":"https://api.github.com/repos/aspnet/Microsoft.Data.Sqlite/issues/161","number":161,"state":"open","locked":false,"title":"Automatically adjust for filesystem defaults on UWP","user":{"login":"natemcmaster","id":2696087,"avatar_url":"https://avatars.githubusercontent.com/u/2696087?v=3","gravatar_id":"","url":"https://api.github.com/users/natemcmaster","html_url":"https://github.com/natemcmaster","followers_url":"https://api.github.com/users/natemcmaster/followers","following_url":"https://api.github.com/users/natemcmaster/following{/other_user}","gists_url":"https://api.github.com/users/natemcmaster/gists{/gist_id}","starred_url":"https://api.github.com/users/natemcmaster/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/natemcmaster/subscriptions","organizations_url":"https://api.github.com/users/natemcmaster/orgs","repos_url":"https://api.github.com/users/natemcmaster/repos","events_url":"https://api.github.com/users/natemcmaster/events{/privacy}","received_events_url":"https://api.github.com/users/natemcmaster/received_events","type":"User","site_admin":false},"body":"Changes\r\n - Set temporary folder on connection open on UWP\r\n - Adjust relative paths to local folder by default\r\n\r\n\r\nAdds test project to solution.\r\n\r\nFix #116.\r\nFixes relative path issue on UWP (see #55)","created_at":"2015-10-26T22:11:09Z","updated_at":"2015-10-27T02:16:37Z","closed_at":null,"merged_at":null,"merge_commit_sha":"359864002b2afedc859f368af968a2ead04b5675","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/aspnet/Microsoft.Data.Sqlite/pulls/161/commits","review_comments_url":"https://api.github.com/repos/aspnet/Microsoft.Data.Sqlite/pulls/161/comments","review_comment_url":"https://api.github.com/repos/aspnet/Microsoft.Data.Sqlite/pulls/comments{/number}","comments_url":"https://api.github.com/repos/aspnet/Microsoft.Data.Sqlite/issues/161/comments","statuses_url":"https://api.github.com/repos/aspnet/Microsoft.Data.Sqlite/statuses/39b1c038ad2523b08b509f0a4dce929920feebc3","head":{"label":"aspnet:namc/uap","ref":"namc/uap","sha":"39b1c038ad2523b08b509f0a4dce929920feebc3","user":{"login":"aspnet","id":6476660,"avatar_url":"https://avatars.githubusercontent.com/u/6476660?v=3","gravatar_id":"","url":"https://api.github.com/users/aspnet","html_url":"https://github.com/aspnet","followers_url":"https://api.github.com/users/aspnet/followers","following_url":"https://api.github.com/users/aspnet/following{/other_user}","gists_url":"https://api.github.com/users/aspnet/gists{/gist_id}","starred_url":"https://api.github.com/users/aspnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aspnet/subscriptions","organizations_url":"https://api.github.com/users/aspnet/orgs","repos_url":"https://api.github.com/users/aspnet/repos","events_url":"https://api.github.com/users/aspnet/events{/privacy}","received_events_url":"https://api.github.com/users/aspnet/received_events","type":"Organization","site_admin":false},"repo":{"id":16859015,"name":"Microsoft.Data.Sqlite","full_name":"aspnet/Microsoft.Data.Sqlite","owner":{"login":"aspnet","id":6476660,"avatar_url":"https://avatars.githubusercontent.com/u/6476660?v=3","gravatar_id":"","url":"https://api.github.com/users/aspnet","html_url":"https://github.com/aspnet","followers_url":"https://api.github.com/users/aspnet/followers","following_url":"https://api.github.com/users/aspnet/following{/other_user}","gists_url":"https://api.github.com/users/aspnet/gists{/gist_id}","starred_url":"https://api.github.com/users/aspnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aspnet/subscriptions","organizations_url":"https://api.github.com/users/aspnet/orgs","repos_url":"https://api.github.com/users/aspnet/repos","events_url":"https://api.github.com/users/aspnet/events{/privacy}","received_events_url":"https://api.github.com/users/aspnet/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/aspnet/Microsoft.Data.Sqlite","description":"SQLite implementations of the System.Data.Common interfaces.","fork":false,"url":"https://api.github.com/repos/aspnet/Microsoft.Data.Sqlite","forks_url":"https://api.github.com/repos/aspnet/Microsoft.Data.Sqlite/forks","keys_url":"https://api.github.com/repos/aspnet/Microsoft.Data.Sqlite/keys{/key_id}","collaborators_url":"https://api.github.com/repos/aspnet/Microsoft.Data.Sqlite/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/aspnet/Microsoft.Data.Sqlite/teams","hooks_url":"https://api.github.com/repos/aspnet/Microsoft.Data.Sqlite/hooks","issue_events_url":"https://api.github.com/repos/aspnet/Microsoft.Data.Sqlite/issues/events{/number}","events_url":"https://api.github.com/repos/aspnet/Microsoft.Data.Sqlite/events","assignees_url":"https://api.github.com/repos/aspnet/Microsoft.Data.Sqlite/assignees{/user}","branches_url":"https://api.github.com/repos/aspnet/Microsoft.Data.Sqlite/branches{/branch}","tags_url":"https://api.github.com/repos/aspnet/Microsoft.Data.Sqlite/tags","blobs_url":"https://api.github.com/repos/aspnet/Microsoft.Data.Sqlite/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/aspnet/Microsoft.Data.Sqlite/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/aspnet/Microsoft.Data.Sqlite/git/refs{/sha}","trees_url":"https://api.github.com/repos/aspnet/Microsoft.Data.Sqlite/git/trees{/sha}","statuses_url":"https://api.github.com/repos/aspnet/Microsoft.Data.Sqlite/statuses/{sha}","languages_url":"https://api.github.com/repos/aspnet/Microsoft.Data.Sqlite/languages","stargazers_url":"https://api.github.com/repos/aspnet/Microsoft.Data.Sqlite/stargazers","contributors_url":"https://api.github.com/repos/aspnet/Microsoft.Data.Sqlite/contributors","subscribers_url":"https://api.github.com/repos/aspnet/Microsoft.Data.Sqlite/subscribers","subscription_url":"https://api.github.com/repos/aspnet/Microsoft.Data.Sqlite/subscription","commits_url":"https://api.github.com/repos/aspnet/Microsoft.Data.Sqlite/commits{/sha}","git_commits_url":"https://api.github.com/repos/aspnet/Microsoft.Data.Sqlite/git/commits{/sha}","comments_url":"https://api.github.com/repos/aspnet/Microsoft.Data.Sqlite/comments{/number}","issue_comment_url":"https://api.github.com/repos/aspnet/Microsoft.Data.Sqlite/issues/comments{/number}","contents_url":"https://api.github.com/repos/aspnet/Microsoft.Data.Sqlite/contents/{+path}","compare_url":"https://api.github.com/repos/aspnet/Microsoft.Data.Sqlite/compare/{base}...{head}","merges_url":"https://api.github.com/repos/aspnet/Microsoft.Data.Sqlite/merges","archive_url":"https://api.github.com/repos/aspnet/Microsoft.Data.Sqlite/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/aspnet/Microsoft.Data.Sqlite/downloads","issues_url":"https://api.github.com/repos/aspnet/Microsoft.Data.Sqlite/issues{/number}","pulls_url":"https://api.github.com/repos/aspnet/Microsoft.Data.Sqlite/pulls{/number}","milestones_url":"https://api.github.com/repos/aspnet/Microsoft.Data.Sqlite/milestones{/number}","notifications_url":"https://api.github.com/repos/aspnet/Microsoft.Data.Sqlite/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/aspnet/Microsoft.Data.Sqlite/labels{/name}","releases_url":"https://api.github.com/repos/aspnet/Microsoft.Data.Sqlite/releases{/id}","created_at":"2014-02-15T08:12:41Z","updated_at":"2015-10-17T00:48:52Z","pushed_at":"2015-10-26T22:12:43Z","git_url":"git://github.com/aspnet/Microsoft.Data.Sqlite.git","ssh_url":"git@github.com:aspnet/Microsoft.Data.Sqlite.git","clone_url":"https://github.com/aspnet/Microsoft.Data.Sqlite.git","svn_url":"https://github.com/aspnet/Microsoft.Data.Sqlite","homepage":"","size":2025,"stargazers_count":78,"watchers_count":78,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":32,"mirror_url":null,"open_issues_count":20,"forks":32,"open_issues":20,"watchers":78,"default_branch":"dev"}},"base":{"label":"aspnet:dev","ref":"dev","sha":"372e7ac3233ccd7051e159e0d3677e2a4ef3cad9","user":{"login":"aspnet","id":6476660,"avatar_url":"https://avatars.githubusercontent.com/u/6476660?v=3","gravatar_id":"","url":"https://api.github.com/users/aspnet","html_url":"https://github.com/aspnet","followers_url":"https://api.github.com/users/aspnet/followers","following_url":"https://api.github.com/users/aspnet/following{/other_user}","gists_url":"https://api.github.com/users/aspnet/gists{/gist_id}","starred_url":"https://api.github.com/users/aspnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aspnet/subscriptions","organizations_url":"https://api.github.com/users/aspnet/orgs","repos_url":"https://api.github.com/users/aspnet/repos","events_url":"https://api.github.com/users/aspnet/events{/privacy}","received_events_url":"https://api.github.com/users/aspnet/received_events","type":"Organization","site_admin":false},"repo":{"id":16859015,"name":"Microsoft.Data.Sqlite","full_name":"aspnet/Microsoft.Data.Sqlite","owner":{"login":"aspnet","id":6476660,"avatar_url":"https://avatars.githubusercontent.com/u/6476660?v=3","gravatar_id":"","url":"https://api.github.com/users/aspnet","html_url":"https://github.com/aspnet","followers_url":"https://api.github.com/users/aspnet/followers","following_url":"https://api.github.com/users/aspnet/following{/other_user}","gists_url":"https://api.github.com/users/aspnet/gists{/gist_id}","starred_url":"https://api.github.com/users/aspnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aspnet/subscriptions","organizations_url":"https://api.github.com/users/aspnet/orgs","repos_url":"https://api.github.com/users/aspnet/repos","events_url":"https://api.github.com/users/aspnet/events{/privacy}","received_events_url":"https://api.github.com/users/aspnet/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/aspnet/Microsoft.Data.Sqlite","description":"SQLite implementations of the System.Data.Common interfaces.","fork":false,"url":"https://api.github.com/repos/aspnet/Microsoft.Data.Sqlite","forks_url":"https://api.github.com/repos/aspnet/Microsoft.Data.Sqlite/forks","keys_url":"https://api.github.com/repos/aspnet/Microsoft.Data.Sqlite/keys{/key_id}","collaborators_url":"https://api.github.com/repos/aspnet/Microsoft.Data.Sqlite/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/aspnet/Microsoft.Data.Sqlite/teams","hooks_url":"https://api.github.com/repos/aspnet/Microsoft.Data.Sqlite/hooks","issue_events_url":"https://api.github.com/repos/aspnet/Microsoft.Data.Sqlite/issues/events{/number}","events_url":"https://api.github.com/repos/aspnet/Microsoft.Data.Sqlite/events","assignees_url":"https://api.github.com/repos/aspnet/Microsoft.Data.Sqlite/assignees{/user}","branches_url":"https://api.github.com/repos/aspnet/Microsoft.Data.Sqlite/branches{/branch}","tags_url":"https://api.github.com/repos/aspnet/Microsoft.Data.Sqlite/tags","blobs_url":"https://api.github.com/repos/aspnet/Microsoft.Data.Sqlite/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/aspnet/Microsoft.Data.Sqlite/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/aspnet/Microsoft.Data.Sqlite/git/refs{/sha}","trees_url":"https://api.github.com/repos/aspnet/Microsoft.Data.Sqlite/git/trees{/sha}","statuses_url":"https://api.github.com/repos/aspnet/Microsoft.Data.Sqlite/statuses/{sha}","languages_url":"https://api.github.com/repos/aspnet/Microsoft.Data.Sqlite/languages","stargazers_url":"https://api.github.com/repos/aspnet/Microsoft.Data.Sqlite/stargazers","contributors_url":"https://api.github.com/repos/aspnet/Microsoft.Data.Sqlite/contributors","subscribers_url":"https://api.github.com/repos/aspnet/Microsoft.Data.Sqlite/subscribers","subscription_url":"https://api.github.com/repos/aspnet/Microsoft.Data.Sqlite/subscription","commits_url":"https://api.github.com/repos/aspnet/Microsoft.Data.Sqlite/commits{/sha}","git_commits_url":"https://api.github.com/repos/aspnet/Microsoft.Data.Sqlite/git/commits{/sha}","comments_url":"https://api.github.com/repos/aspnet/Microsoft.Data.Sqlite/comments{/number}","issue_comment_url":"https://api.github.com/repos/aspnet/Microsoft.Data.Sqlite/issues/comments{/number}","contents_url":"https://api.github.com/repos/aspnet/Microsoft.Data.Sqlite/contents/{+path}","compare_url":"https://api.github.com/repos/aspnet/Microsoft.Data.Sqlite/compare/{base}...{head}","merges_url":"https://api.github.com/repos/aspnet/Microsoft.Data.Sqlite/merges","archive_url":"https://api.github.com/repos/aspnet/Microsoft.Data.Sqlite/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/aspnet/Microsoft.Data.Sqlite/downloads","issues_url":"https://api.github.com/repos/aspnet/Microsoft.Data.Sqlite/issues{/number}","pulls_url":"https://api.github.com/repos/aspnet/Microsoft.Data.Sqlite/pulls{/number}","milestones_url":"https://api.github.com/repos/aspnet/Microsoft.Data.Sqlite/milestones{/number}","notifications_url":"https://api.github.com/repos/aspnet/Microsoft.Data.Sqlite/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/aspnet/Microsoft.Data.Sqlite/labels{/name}","releases_url":"https://api.github.com/repos/aspnet/Microsoft.Data.Sqlite/releases{/id}","created_at":"2014-02-15T08:12:41Z","updated_at":"2015-10-17T00:48:52Z","pushed_at":"2015-10-26T22:12:43Z","git_url":"git://github.com/aspnet/Microsoft.Data.Sqlite.git","ssh_url":"git@github.com:aspnet/Microsoft.Data.Sqlite.git","clone_url":"https://github.com/aspnet/Microsoft.Data.Sqlite.git","svn_url":"https://github.com/aspnet/Microsoft.Data.Sqlite","homepage":"","size":2025,"stargazers_count":78,"watchers_count":78,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":32,"mirror_url":null,"open_issues_count":20,"forks":32,"open_issues":20,"watchers":78,"default_branch":"dev"}},"_links":{"self":{"href":"https://api.github.com/repos/aspnet/Microsoft.Data.Sqlite/pulls/161"},"html":{"href":"https://github.com/aspnet/Microsoft.Data.Sqlite/pull/161"},"issue":{"href":"https://api.github.com/repos/aspnet/Microsoft.Data.Sqlite/issues/161"},"comments":{"href":"https://api.github.com/repos/aspnet/Microsoft.Data.Sqlite/issues/161/comments"},"review_comments":{"href":"https://api.github.com/repos/aspnet/Microsoft.Data.Sqlite/pulls/161/comments"},"review_comment":{"href":"https://api.github.com/repos/aspnet/Microsoft.Data.Sqlite/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/aspnet/Microsoft.Data.Sqlite/pulls/161/commits"},"statuses":{"href":"https://api.github.com/repos/aspnet/Microsoft.Data.Sqlite/statuses/39b1c038ad2523b08b509f0a4dce929920feebc3"}}}}