VitalElement / AvalonStudio.Shell

Reusable Shell components from AvalonStudio.
GNU Lesser General Public License v2.1
76 stars 21 forks source link

Change the Extensions directory to be under the BaseDirectory #11

Open nopara73 opened 6 years ago

nopara73 commented 6 years ago

I created a Windows installer with Wix and I noticed that the software wasn't working. The reason being is that you can never work next to the exe, since that is located in the Program Files, which needs admin access and the software as launched it doesn't have that.

So, in AvalonStudio.Shell, the Extensions folder couldn't be created, thus the software failed to launch. The code below does this in AvalonStudio.

public static string ExecutionPath => Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);

public static string ExtensionsFolder => Path.Combine(ExecutionPath, "Extensions");

I suggest changing the second line to this:

public static string ExtensionsFolder => Path.Combine(BaseDirectory, "Extensions");

Since I have no idea what that does, my question is: is it safe to change this? (I didn't test.)
Related issue: https://github.com/zkSNACKs/WalletWasabi/issues/686

danwalmsley commented 6 years ago

Hmm I think its safe, but @jp2masa might have some input?

danwalmsley commented 6 years ago

The thing is you would end up with executable code, dlls not in program files, perhaps installing extensions is something that should require admin rights.

danwalmsley commented 6 years ago

As a workaround can your installer create the directory, wasabiwallet wont need to modify the contents if this directory since extensions are not supported or enabled. I have to work out how extensions would be installed before making a decision on how this should be fixed. I think if we had got round to making an installer for AvalonStudio we would have seen the same issue, and probably had installer create that dir. I wonder where visual studio keeps its extensions.

nopara73 commented 6 years ago

@danwalmsley As I said in the related Wasabi issue I hacked around it similarly as you suggested here. However note, if anyone will want to create an installer using this repo, will have issues those cannot be hacked around like this, if they actually intend to use the extensions, namely that every time they release an upgrade all extensions will be removed (Since the upgrade deletes the app folder in the Program Files, thus the extensions with it.)

Anyway, as I said it's not a big issue for me, since I don't use the extensions, just something to keep in mind for you.

danwalmsley commented 6 years ago

@nopara73 ok thanks :)

@jp2masa advised: right, we shouldn't create the directories at runtime I think, we should do that when installing, also about installing extensions: VS uses program files for all users, local app data for current user