commontk / AppLauncher

Simple and small program allowing to set the environment of any executable.
http://www.commontk.org
Apache License 2.0
31 stars 32 forks source link

ENH: Allow user settings file to be in <APPLAUNCHER_DIR> #114

Closed lassoan closed 3 years ago

lassoan commented 4 years ago

User settings file was always stored in the user profile directory, which made it impossible to create completely self-contained, portable applications (which store all settings within <APPLAUNCHER_DIR> and subfolders).

This is addressed by looking for UserAdditionalSettings file at <APPLAUNCHER_DIR>/<organisationName|organizationDomain>/<ApplicationName>(-<revision>).ini first and if it is found then that is used. If settings is not found there then the user's profile directory is used the same way as before.

This change is necessary for allowing portable installations of 3D Slicer (https://github.com/Slicer/Slicer/pull/5029).

lassoan commented 4 years ago

@jcfr I could not test this, as on Windows I get this build error (probably because I don't have a static build of Qt):

This has not been tested, as

1>------ Build started: Project: copyDistributables, Configuration: Release x64 ------
2>------ Skipped Build: Project: Continuous, Configuration: Release x64 ------
2>Project not selected to build for this solution configuration 
3>------ Skipped Build: Project: Experimental, Configuration: Release x64 ------
3>Project not selected to build for this solution configuration 
4>------ Skipped Build: Project: Nightly, Configuration: Release x64 ------
4>Project not selected to build for this solution configuration 
5>------ Skipped Build: Project: NightlyMemoryCheck, Configuration: Release x64 ------
5>Project not selected to build for this solution configuration 
6>------ Skipped Build: Project: RUN_TESTS, Configuration: Release x64 ------
6>Project not selected to build for this solution configuration 
7>------ Build started: Project: CTKAppLauncherBase, Configuration: Release x64 ------
8>------ Skipped Build: Project: doc, Configuration: Release x64 ------
8>Project not selected to build for this solution configuration 
9>------ Skipped Build: Project: doc-tarballs, Configuration: Release x64 ------
9>Project not selected to build for this solution configuration 
7>ctkAppLauncher.cpp
7>CTKAppLauncherBase.vcxproj -> C:\D\AppLauncher-build\bin\Release\CTKAppLauncherBase.lib
10>------ Build started: Project: CTKAppLauncher, Configuration: Release x64 ------
11>------ Build started: Project: CTKAppLauncherBaseCppTests, Configuration: Release x64 ------
12>------ Build started: Project: CTKAppLauncherW, Configuration: Release x64 ------
12>CTKAppLauncherW.vcxproj -> C:\D\AppLauncher-build\bin\Release\CTKAppLauncherW.exe
10>CTKAppLauncher.vcxproj -> C:\D\AppLauncher-build\bin\Release\CTKAppLauncher.exe
11>CTKAppLauncherBaseCppTests.obj : error LNK2019: unresolved external symbol "struct QStaticPlugin const __cdecl qt_static_plugin_QWindowsIntegrationPlugin(void)" (?qt_static_plugin_QWindowsIntegrationPlugin@@YA?BUQStaticPlugin@@XZ) referenced in function "void __cdecl `dynamic initializer for 'staticQWindowsIntegrationPluginInstance''(void)" (??__EstaticQWindowsIntegrationPluginInstance@@YAXXZ)
11>C:\D\AppLauncher-build\bin\Release\CTKAppLauncherBaseCppTests.exe : fatal error LNK1120: 1 unresolved externals
11>Done building project "CTKAppLauncherBaseCppTests.vcxproj" -- FAILED.
13>------ Skipped Build: Project: INSTALL, Configuration: Release x64 ------
13>Project not selected to build for this solution configuration 
14>------ Skipped Build: Project: PACKAGE, Configuration: Release x64 ------
14>Project not selected to build for this solution configuration 
========== Build: 4 succeeded, 1 failed, 4 up-to-date, 9 skipped ==========

I did not have this build error before, so it would be nice to fix this, too, but I don't know where the issue is.

jcfr commented 4 years ago

probably because I don't have a static build of Qt

Most likely, we also don't have test with recent version of Qt5

I will enable Appveyor build for fork .. that way we will get feedback here.

jcfr commented 4 years ago

We will also need to address the failures on Travis and CircleCI

jcfr commented 4 years ago

I just re-enabled the AppVeyor. Travis error are specific to this PR CircleCI error are currently happening independently of this PR

See https://github.com/commontk/AppLauncher/pull/115

lassoan commented 4 years ago

@jcfr I don't know how to test this. Would you be able to test and make any fixes that are needed?

lassoan commented 3 years ago

I've updated the pull request. Now all tests are passing on circleci and appveyor.

I've also tested on Windows that the changes allow installation of Slicer extensions within the application's folder (with relative paths). See https://github.com/Slicer/Slicer/pull/5029.

@jcfr It would be great if you could review and integrate.

lassoan commented 3 years ago

@jcfr It would be great if you could review, merge, and generate new applauncher binaries. This would allow me to test portable Slicer (https://github.com/Slicer/Slicer/pull/5029) on all platforms.