-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for defining settings folder
- Loading branch information
Showing
13 changed files
with
135 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
namespace RepoM.Api.IO; | ||
|
||
public record struct AppDataPathConfig | ||
{ | ||
public string? AppSettingsPath { get; init; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
namespace RepoM.Api.IO; | ||
|
||
using System; | ||
using System.IO; | ||
using RepoM.Core.Plugin.Common; | ||
|
||
public sealed class AppDataPathProvider : IAppDataPathProvider | ||
{ | ||
public AppDataPathProvider(AppDataPathConfig config) | ||
{ | ||
ArgumentNullException.ThrowIfNull(config); | ||
if (!string.IsNullOrWhiteSpace(config.AppSettingsPath)) | ||
{ | ||
AppDataPath = Path.GetFullPath(config.AppSettingsPath); | ||
return; | ||
} | ||
|
||
AppDataPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "RepoM"); | ||
} | ||
|
||
public string AppDataPath { get; } | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
namespace RepoM.App.Configuration; | ||
|
||
public class Config | ||
{ | ||
/// <summary> | ||
/// Absolute or relative path to the app settings folder. | ||
/// </summary> | ||
public string? AppSettingsPath { get; init; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"profiles": { | ||
"RepoM.App bin config": { | ||
"commandName": "Project", | ||
"commandLineArgs": "--App:AppSettingsPath RepoMConfig" | ||
}, | ||
"RepoM.App": { | ||
"commandName": "Project" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// begin-snippet: appsettings-appsettingspath | ||
{ | ||
"App": { | ||
// Absolute or relative path to the configuration directory. | ||
// like: "AppSettingsPath": "C:/my-config/", | ||
"AppSettingsPath": "MyConfig" | ||
} | ||
} | ||
// end-snippet |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"App": { | ||
"AppSettingsPath": null | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters