I need a way of finding a folder for a portable application which can always be found if it exists (and otherwise it can be created), and which is accessible to the user and the application, such that the files within it can be edited and added to by the user, and read/edited by the application (so, embedded resources do not solve the problem).
My issue is that I don't know where that default folder/directory should be. Should it be in the same folder as the application .exe
? Should I be using a SpecialFolder
? Or something else entirely?
This is really more a question about standard practices for portable applications in C# and .NET, rather than a question on how to implement this directly (although links to any specific classes/code mentioned would still be very helpful).
My thoughts so far:
I prefer the idea of it being placed in the same directory as the
.exe
, as then if the application folder is moved the important files can still be easily located manually. However, if the user were to move the application toProgram Files
, or something (which doesn't seem too unreasonable?), I worry that the files may end up requiring Administrator privileges to edit/open, which will break the application.Using a user directory, or similar, would also work, but I don't know whether it's acceptable standard practice for a portable application to be writing to user folders (seems a bit off to me, personally). But I don't know if there's a way to make this more palatable?
Any suggestions would be greatly appreciated.