Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SupportedMediaTypes.json Location #25

Open
wjvii opened this issue Jul 8, 2020 · 0 comments
Open

SupportedMediaTypes.json Location #25

wjvii opened this issue Jul 8, 2020 · 0 comments

Comments

@wjvii
Copy link

wjvii commented Jul 8, 2020

In issue #23 it mentions that it uses an embedded version of this file in the assembly but in the code in Documents.cs it also look like if there is not a file on disk it tries to write it out to disk.

`var assembly = Assembly.GetAssembly(typeof(Documents));
var assemblyPath = Path.GetDirectoryName(assembly.Location);
var typesFile = Path.Combine(assemblyPath, "SupportedMediaTypes.json");

if (!File.Exists(typesFile))
{
// unpack the types file to the assembly path
using (var resource = assembly.GetManifestResourceStream("InterFAX.Api.SupportedMediaTypes.json"))
{
using (var file = new FileStream(typesFile, FileMode.Create, FileAccess.Write))
{
resource.CopyTo(file);
}
}
}`

This is a problem I am encountering because it is trying to write the file into the same folder as that the assembly is located in, which if often protected from writing and which with a Store applications it cannot do.

Would it be possible to have a property that is set to define where to write this file and any other files it needs? I have seen other products that define something like "ReferencePath" so that we can define where this is written or I believe this location will work properly for most desktop scenarios, Store and non-Store, although I am not sure about web.

Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant