CMake Flag to CustomApp not to read `slicerrc.py` or define other file?

Hi everyone!
I´ve some trouble betweeen CustomApp and normal Slicer because first one read slicerrc.py file. Is ther any way to complie CustomApp not to read this file or define a custom rc file to be saved instead?

Thanks in advance!

Good catch! Custom Slicer applications should be completely independent from standard 3D Slicer applications. By default, a custom application’s startup script name should be determined by the application name, such as .<applicationname>rc.py.

It should be also possible to disable using a startup script for a custom application. It is probably already feasible by setting a custom environment variable in the launcher or by passing --ignore-slicerrc argument to the main application in the launcher, but it would be nice to have a dedicated CMake option or application configuration flag for it.

@jcfr @pieper scary do you think?

1 Like

Even should be nice to link it to “Slicer_STORE_SETTINGS_IN_APPLICATION_HOME_DIR” flag not to loose portability…

1 Like

Agreed, the custom app should be completely independent of Slicer in terms of settings, rc file, etc.

In the past, we have applied a patch like the following. Generalizing as discussed above would indeed be sensible.

diff --git a/Base/QTCore/qSlicerCoreCommandOptions.cxx b/Base/QTCore/qSlicerCoreCommandOptions.cxx
index 41bc603fb53..df309efdb5b 100644
--- a/Base/QTCore/qSlicerCoreCommandOptions.cxx
+++ b/Base/QTCore/qSlicerCoreCommandOptions.cxx
@@ -128,8 +128,9 @@ bool qSlicerCoreCommandOptions::ignoreRest() const
 bool qSlicerCoreCommandOptions::ignoreSlicerRC()const
 {
   Q_D(const qSlicerCoreCommandOptions);
-  return d->ParsedArgs.value("ignore-slicerrc").toBool() ||
-      this->isTestingEnabled();
+  //return d->ParsedArgs.value("ignore-slicerrc").toBool() ||
+  //    this->isTestingEnabled();
+  return true;
 }

@apparrilla I have been using conditions like this to differentiate how the slicerrc file is used in each case. This may be useful in the short term.

if slicer.app.mainApplicationName == 'Slicer':

If we are redesigning this part, I suggest moving the file to another place, to decrease the number of paths where relevant Slicer related files are stored, and to make it easier to find files for any given application. More concretely, the user folder’s root only contains this one file, but I think we could move it to where the app’s main configuration file is located: AppData/Roaming/[org.name] (on Windows). Then we may want to change its name as well to correspond to the application name.

1 Like