Results 1 to 5 of 5

Thread: Problen with add system environment.

  1. #1
    Join Date
    Sep 2007
    Posts
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Problen with add system environment.

    Hi all. Sorry for my English. English is not their native language.

    I am having a problem when adds system environment on Windows.

    Example from the Assistant don't work:
    Qt Code:
    1. QProcess process;
    2. QStringList env = QProcess::systemEnvironment();
    3. env << "TMPDIR=C:\\MyApp\\temp"; // Add an environment variable
    4. env.replaceInStrings(QRegExp("^PATH=(.*)", Qt::CaseInsensitive), "PATH=\\1;C:\\Bin");
    5. process.setEnvironment(env);
    6. process.start("myapp");
    To copy to clipboard, switch view to plain text mode 

    Does anyone have any idea about what is happening?
    Thanks.

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Problen with add system environment.

    What do you mean with "does not work"? QProcess::setEnvironment() sets the environment of that particular process. It does not affect system environment.
    J-P Nurmi

  3. #3
    Join Date
    Sep 2007
    Posts
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Problen with add system environment.

    Ok. Can you give me please example of code which add system environment.

  4. #4
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Problen with add system environment.

    I guess you'll have to use the API on whichever platform you use.
    There's no support in Qt for this=.


    Regards.

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Problen with add system environment.

    Is it possible at all? One process shouldn't be able to change the environment of another process, this would violate system security.

Similar Threads

  1. Qt Cryptographic Architecture
    By vermarajeev in forum Qt Programming
    Replies: 6
    Last Post: 9th February 2007, 13:15

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.