C
C#10mo ago
BruceA

Why can't Visual Studio find this file?

StorageFile renderingConstantsStorage = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///PelotonIDE\\Presentation\\RenderingConstants.json"));
StorageFile renderingConstantsStorage = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///PelotonIDE\\Presentation\\RenderingConstants.json"));
That should work. I have two other JSON files that I load using the exact same syntax. But this file refuses to be found. One of the ones that work is
public static async Task<InterpreterParametersStructure?> GetPerTabInterpreterParameters()
{
StorageFile tabSettingStorage = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///PelotonIDE\\Presentation\\PerTabInterpreterParameters.json"));
string tabSettings = File.ReadAllText(tabSettingStorage.Path);
return JsonConvert.DeserializeObject<InterpreterParametersStructure>(tabSettings);
}
public static async Task<InterpreterParametersStructure?> GetPerTabInterpreterParameters()
{
StorageFile tabSettingStorage = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///PelotonIDE\\Presentation\\PerTabInterpreterParameters.json"));
string tabSettings = File.ReadAllText(tabSettingStorage.Path);
return JsonConvert.DeserializeObject<InterpreterParametersStructure>(tabSettings);
}
but the one that doesn't is
public static async Task<RenderingConstantsStructure?> GetJSONRenderingConstants()
{
StorageFile renderingConstantsStorage = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///PelotonIDE\\Presentation\\RenderingConstants.json")); // \Presentation\RenderingConstants.json
string renderingConstantsJson = File.ReadAllText(renderingConstantsStorage.Path);
return JsonConvert.DeserializeObject<RenderingConstantsStructure>(renderingConstantsJson);
}
public static async Task<RenderingConstantsStructure?> GetJSONRenderingConstants()
{
StorageFile renderingConstantsStorage = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///PelotonIDE\\Presentation\\RenderingConstants.json")); // \Presentation\RenderingConstants.json
string renderingConstantsJson = File.ReadAllText(renderingConstantsStorage.Path);
return JsonConvert.DeserializeObject<RenderingConstantsStructure>(renderingConstantsJson);
}
The file is present in the folder
Directory of C:\Users\bugma\Source\Repos\Present\Ptarmigan\PelotonIDE\PelotonIDE\Presentation

11/03/2024 01:37 PM 496 FactorySettings.json
11/03/2024 12:37 PM 2,749,458 LanguageConfiguration.json
11/03/2024 01:38 PM 4,148 PerTabInterpreterParameters.json
11/03/2024 11:44 AM 126 RenderingConstants.json
4 File(s) 2,754,228 bytes
0 Dir(s) 250,172,039,168 bytes free
Directory of C:\Users\bugma\Source\Repos\Present\Ptarmigan\PelotonIDE\PelotonIDE\Presentation

11/03/2024 01:37 PM 496 FactorySettings.json
11/03/2024 12:37 PM 2,749,458 LanguageConfiguration.json
11/03/2024 01:38 PM 4,148 PerTabInterpreterParameters.json
11/03/2024 11:44 AM 126 RenderingConstants.json
4 File(s) 2,754,228 bytes
0 Dir(s) 250,172,039,168 bytes free
The properties for all the JSON files are the same. So why doesn't the program find the file?
No description
1 Reply
OkOk
OkOk10mo ago
I would print out the folder contents with that same path, this will show you if you are in the right location
Want results from more Discord servers?
Add your server