title: Redefining application data folder in uwp app
body: <p>I'm writing a UWP application to interacting with SQLite database. I implemented a data scheme, that using to create new file in specific directory.</p>
  
  <p>All I found about paths is on the code below. It creates files in %username%\AppData\Local...\Appname_t07g111c25az6\folder_defined_in_code. But I wanna create it in application root folder (C:/Projects/AppName/src/Assets).</p>
  
  <p>Settings.cs</p>
  
  <pre><code>static public readonly string DatabasePath = "Database";
  static public readonly string DatabaseName = $"{DB_NAME}.db";
  static public readonly string DatabasePattern = $"{DB_NAME}.pattern.db";
  static public readonly string DatabaseFileName = Path.Combine(DatabasePath, DatabaseName);
  static public readonly string DatabasePatternFileName = Path.Combine(DatabasePath, DatabasePattern);
  static public readonly string DatabaseUrl = $"{DB_BASEURI}/{DatabaseName}";
  public readonly string SQLiteConnectionString = $"Data Source={DatabaseFileName}";
  </code></pre>
  
  <p>Startup.cs</p>
  
  <pre><code>private static async Task EnsureSQLiteDatabaseAsync()
          {
              var localFolder = ApplicationData.Current.LocalFolder; ;
              var databaseFolder = await localFolder.CreateFolderAsync(AppSettings.DatabasePath, CreationCollisionOption.OpenIfExists);
  
              if (await databaseFolder.TryGetItemAsync(AppSettings.DatabaseName) == null)
              {
                  var sourceFile = await databaseFolder.GetFileAsync(AppSettings.DatabasePattern);
                  var targetFile = await databaseFolder.CreateFileAsync(AppSettings.DatabaseName, CreationCollisionOption.ReplaceExisting);
                  await sourceFile.CopyAndReplaceAsync(targetFile);
              }
          }
  </code></pre>