mirror of
https://github.com/oqtane/oqtane.framework.git
synced 2025-05-29 08:13:05 +00:00
Merge pull request #2369 from sbwalker/dev
check for existence of appsettings.json on Maui
This commit is contained in:
commit
6e0de6f7bf
@ -63,13 +63,16 @@ public static class MauiProgram
|
||||
private static void LoadAppSettings()
|
||||
{
|
||||
string file = Path.Combine(FileSystem.Current.AppDataDirectory, "appsettings.json");
|
||||
using FileStream stream = File.OpenRead(file);
|
||||
using StreamReader reader = new StreamReader(stream);
|
||||
var content = reader.ReadToEnd();
|
||||
var obj = JsonSerializer.Deserialize<JsonObject>(content)!;
|
||||
if (!string.IsNullOrEmpty((string)obj["Url"]))
|
||||
if (File.Exists(file))
|
||||
{
|
||||
url = (string)obj["Url"];
|
||||
using FileStream stream = File.OpenRead(file);
|
||||
using StreamReader reader = new StreamReader(stream);
|
||||
var content = reader.ReadToEnd();
|
||||
var obj = JsonSerializer.Deserialize<JsonObject>(content)!;
|
||||
if (!string.IsNullOrEmpty((string)obj["Url"]))
|
||||
{
|
||||
url = (string)obj["Url"];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user