<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <!-- jsextension-environment.qdoc --> <title>Environment Service | Qbs Manual</title> <link rel="stylesheet" type="text/css" href="style/offline-simple.css" /> <script type="text/javascript"> document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css"); // loading style sheet breaks anchors that were jumped to before // so force jumping to anchor again setTimeout(function() { var anchor = location.hash; // need to jump to different anchor first (e.g. none) location.hash = "#"; setTimeout(function() { location.hash = anchor; }, 0); }, 0); </script> </head> <body> <div class="header" id="qtdocheader"> <div class="main"> <div class="main-rounded"> <div class="navigationbar"> <table><tr> <td ><a href="index.html">Qbs Manual</a></td><td ><a href="list-of-builtin-services.html">List of Built-in Services</a></td><td >Environment Service</td></tr></table><table class="buildversion"><tr> <td id="buildversion" width="100%" align="right">Qbs 1.12.2</td> </tr></table> </div> </div> <div class="content"> <div class="line"> <div class="content mainContent"> <p class="naviNextPrevious headerNavi"> </p><p/> <div class="sidebar"> <div class="toc"> <h3><a name="toc">Contents</a></h3> <ul> <li class="level1"><a href="#available-operations">Available Operations</a></li> <li class="level2"><a href="#currentenv">currentEnv</a></li> <li class="level2"><a href="#getenv">getEnv</a></li> <li class="level2"><a href="#putenv">putEnv</a></li> <li class="level2"><a href="#unsetenv">unsetEnv</a></li> </ul> </div> <div class="sidebar-content" id="sidebar-content"></div></div> <h1 class="title">Environment Service</h1> <span class="subtitle"></span> <!-- $$$jsextension-environment.html-description --> <div class="descr"> <a name="details"></a> <p>The <code>Environment</code> service offers access to the system environment or process environment.</p> <a name="available-operations"></a> <h2 id="available-operations">Available Operations</h2> <a name="currentenv"></a> <h3 >currentEnv</h3> <pre class="cpp"> Environment<span class="operator">.</span>currentEnv(): { <span class="operator">[</span>key: string<span class="operator">]</span>: string; } </pre> <p>Returns the environment of Qbs in the current context as an object whose properties are the environment variables.</p> <a name="getenv"></a> <h3 >getEnv</h3> <pre class="cpp"> Environment<span class="operator">.</span>getEnv(key: string): string </pre> <p>Tries to find a variable with the given name in the current context's environment and returns its value. If no such variable could be found, <code>undefined</code> is returned.</p> <a name="putenv"></a> <h3 >putEnv</h3> <pre class="cpp"> Environment<span class="operator">.</span>putEnv(key: string<span class="operator">,</span> value: string): <span class="type">void</span> </pre> <p>Sets the value of the environment variable with the given name in the build or run environment. This method is only available in the <code>Module.setupBuildEnvironment</code> and <code>Module.setupRunEnvironment</code> scripts.</p> <a name="unsetenv"></a> <h3 >unsetEnv</h3> <pre class="cpp"> Environment<span class="operator">.</span>unsetEnv(key: string): <span class="type">void</span> </pre> <p>Unsets the environment variable with the given name from the build or run environment. This method is only available in the <code>Module.setupBuildEnvironment</code> and <code>Module.setupRunEnvironment</code> scripts.</p> </div> <!-- @@@jsextension-environment.html --> <p class="naviNextPrevious footerNavi"> </p> </div> </div> </div> </div> </div> <div class="footer"> <p> <acronym title="Copyright">©</acronym> 2019 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners.<br/> The documentation provided herein is licensed under the terms of the <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation License version 1.3</a> as published by the Free Software Foundation.<br/> Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners. </p> </div> </body> </html>