Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Reload environment on runtime
Qt 6.11 is out! See what's new in the release blog

Reload environment on runtime

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 2 Posters 1.7k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • PabloArgP Offline
    PabloArgP Offline
    PabloArg
    wrote on last edited by
    #1

    Hi,

    I would like to know if possible to reload the environment on runtime. Imagine the following situation. The application start and this add a path to the system, so How Do I reload the environment again that my application can see the new path?

    Thanks for your help

    K 1 Reply Last reply
    0
    • PabloArgP PabloArg

      Hi,

      I would like to know if possible to reload the environment on runtime. Imagine the following situation. The application start and this add a path to the system, so How Do I reload the environment again that my application can see the new path?

      Thanks for your help

      K Offline
      K Offline
      koahnig
      wrote on last edited by
      #2

      @PabloArg

      Apparently, yes with systemEnvironment
      You might want to chekc this out.

      Vote the answer(s) that helped you to solve your issue(s)

      1 Reply Last reply
      0
      • PabloArgP Offline
        PabloArgP Offline
        PabloArg
        wrote on last edited by
        #3

        I saw that option but looks only apply if you are running some Qprocess later. But in my case I am running an external app using ShellExecuteEx of windows. I don't know if I can use it, I tried before without success.

        QProcess process;
        QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
        env.insert("TMPDIR", "C:\MyApp\temp"); // Add an environment variable
        env.insert("PATH", env.value("Path") + ";C:\Bin");
        process.setProcessEnvironment(env);
        process.start("myapp");

        1 Reply Last reply
        0
        • PabloArgP Offline
          PabloArgP Offline
          PabloArg
          wrote on last edited by
          #4

          I have a button that contain the following code:
          QStringList env(QProcess::systemEnvironment());
          qDebug() << env ;

          With my app still running I added a new path from System Property ->environment variable.

          So I click in the button but my new path doesn't show up, any ideas?

          K 1 Reply Last reply
          0
          • PabloArgP PabloArg

            I have a button that contain the following code:
            QStringList env(QProcess::systemEnvironment());
            qDebug() << env ;

            With my app still running I added a new path from System Property ->environment variable.

            So I click in the button but my new path doesn't show up, any ideas?

            K Offline
            K Offline
            koahnig
            wrote on last edited by
            #5

            @PabloArg

            Nope. Unfortunately the only possibility I saw.

            Vote the answer(s) that helped you to solve your issue(s)

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved