<div dir="ltr">Hi,<br><br>I'm not aware QSettings provided by Qt can do it. Your %APPDATA% is not portable as would only work on Windows<br><br>You can always try generate the QGIS.ini file using a templating system<br><br>File QGIS.ini.j2 with following content<br><br>Configuration\MODELS_FOLDER={{APPDATA}}\\QGIS\\QGIS3\\profiles\\default\\processing\\models<br>Configuration\SCRIPTS_FOLDERS={{APPDATA}}\\QGIS\\QGIS3\\profiles\\default\\processing\\scripts<br><br><br>File generate_ini.py with following content<br><br>import os<br>import jinja2<br><br>templateLoader = jinja2.FileSystemLoader(searchpath="./")<br>templateEnv = jinja2.Environment(loader=templateLoader)<br>TEMPLATE_FILE = "QGIS.ini.j2"<br>template = templateEnv.get_template(TEMPLATE_FILE)<br>mydict = {<br>    "APPDATA": os.environ.get("APPDATA")<br>}<br>outputText = template.render(**mydict)<br>with open('QGIS.ini', 'w') as outputfile:<br>    outputfile.write(outputText)<br><br>Then, to write your QGIS.ini file, do<br><br><br>python3 generate_ini.py<br><br><br>The possible deal breakers with this approach are:<br>- you depend from jinja2, a third party Python library,<br>- you can't later reuse the mechanism if for instance QGIS changes the QGIS.ini file later on<br><br><br>Regards<br><br>Thomas<br><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Le mar. 6 juil. 2021 à 09:18, Bo Victor Thomsen <<a href="mailto:bo.victor.thomsen@gmail.com">bo.victor.thomsen@gmail.com</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
  

    
  
  <div>
    <p>To the list -</p>
    <p>Is there a method to use OS (Linux, Windows...) environment
      variables in the QGIS.ini setup file ?</p>
    <p>I had a number of customers asking for a method to "generalize"
      QGIS.ini, so it doesn't contain any "user" specific file and
      directory references, i.e</p>
    <p>(From qgis.ini) <br>
    </p>
    <p><font face="monospace">Configuration\MODELS_FOLDER=<b>C:\\Users\\Bo
          Victor Thomsen\\AppData\\Roaming</b>\\QGIS\\QGIS3\\profiles\\default\\processing\\models<br>
        Configuration\SCRIPTS_FOLDERS=<b>C:\\Users\\Bo Victor
          Thomsen\\AppData\\Roaming</b>\\QGIS\\QGIS3\\profiles\\default\\processing\\scripts<br>
      </font></p>
    <p>could be: <br>
    </p>
    <p><font face="monospace">Configuration\MODELS_FOLDER=<b>%APPDATA%</b>\\QGIS\\QGIS3\\profiles\\default\\processing\\models<br>
        Configuration\SCRIPTS_FOLDERS=<b>%APPDATA%</b>\\QGIS\\QGIS3\\profiles\\default\\processing\\scripts</font><br>
    </p>
    <p>or likewise.</p>
    <p>The ultimate reason is to have a method to distribute a
      "standard" setup for QGIS, complete with plugins and specialized
      setup parameters. This can be done by making a standard QGIS
      installation (which the IT departments love, especially with the
      new .msi package) and afterwards replace the "default" profile
      directory with at  directory specific for the organisation.
      However, the process of making the new profile will place a lot of
      file/directory references in QGIS.ini that is specific for the
      super-user developing the new profile.<br>
    </p>
    <pre cols="72">-- 
Med venlig hilsen / Kind regards

Bo Victor Thomsen</pre>
  </div>

_______________________________________________<br>
QGIS-Developer mailing list<br>
<a href="mailto:QGIS-Developer@lists.osgeo.org" target="_blank">QGIS-Developer@lists.osgeo.org</a><br>
List info: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
Unsubscribe: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
</blockquote></div>