Results 1 to 8 of 8

Thread: Set system $PATH in running environment

  1. #1
    Join Date
    May 2011
    Posts
    17
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Set system $PATH in running environment

    Hi,

    My project is a gui for a command line program. The gui needs to find in the path the command line program.

    If I go to Project > Run Settings > Run Environment and the scroll down to PATH I can add ':/the path to the command line program' and it works.

    But what I want is for my gui to use the system $PATH variable when running.

    I cannot firgure out how to add the system $PATH to the Run Environment PATH. I tried to add :$PATH or :$(PATH) or :${PATH} none seems to work. Would someone know how to add the system $PATH to the already define PATH in the Run Environment?

    Cheers,
    Rno

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Set system $PATH in running environment

    Assuming you are using Qt Creator then:
    • Go to Project, Run Settings.
    • Expand the block headed "Run Environment".
    • Find the combo box labelled "Base configuration for the run configuration".
    • Drop down the list and select "System Environment".
    • Do not change anything in the environment it shows you.

  3. #3
    Join Date
    May 2011
    Posts
    17
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Set system $PATH in running environment

    Hi ChrisW67,

    Thanks but it does not work. So far the only way is to give the path to the command line program. I really would like to give the system path variable to Qt creator.

  4. #4
    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: Set system $PATH in running environment

    The system path is always available to any running program. What QtCreator shows you in its settings is the system path.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    May 2011
    Posts
    17
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Set system $PATH in running environment

    Well maybe I am not understanding what the system path is.

    Qt creator shows this:

    Path is set to /usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games

    When starting a terminal and doing
    echo $PATH
    /home/CAMPUS/Software/32bits/imagic//openmpi/bin:/home/CAMPUS/Software/32bits/XRayView-linux/:/home/CAMPUS/Software/32bits/XDS-IA32_Linux_x86:/home/CAMPUS/Software/64bits/usf:/home/CAMPUS/Software/32bits/solve-2.13/bin:/home/CAMPUS/Software/32bits/shelx_linux:/home/CAMPUS/Software/32bits/sharp-2.6/adm/bin:/home/CAMPUS/Software/32bits/Situs_2.6.3/bin://home/CAMPUS/Software/32bits/rosetta/rosetta_source/bin:/home/CAMPUS/Software/32bits/phenix/phenix-1.7.2-869/build/intel-linux-2.6/bin:/home/CAMPUS/Software/32bits/o/:/usr/local/xtal/ActiveTcl-8.4/bin:/usr/local/xtal/hkl2000:/home/CAMPUS/Software/32bits/fasta/fasta-35.4.1/bin:/home/CAMPUS/auth/xtal/EMAN2/bin:/home/CAMPUS/Software/32bits/chimera/bin:/home/CAMPUS/Software/32bits/ccp4/ccp4-6.2.0/src/phaser/phaser-2.3.0/build/intel-linux/bin:/home/CAMPUS/Software/32bits/ccp4/graphviz-2.20.2/bin:/home/CAMPUS/Software/32bits/ccp4/fasta-35.4.1/bin:/home/CAMPUS/Software/32bits/ccp4/clustalw-2.0.9/bin:/home/CAMPUS/Software/32bits/ccp4/ccp4-6.2.0//bin:/home/CAMPUS/Software/32bits/ccp4/ccp4-6.2.0/share/dbccp4i/bin:/home/CAMPUS/Software/32bits/ccp4/ccp4-6.2.0/ccp4i/bin:/home/CAMPUS/Software/32bits/ccp4/ccp4-6.2.0/etc:/home/CAMPUS/Software/32bits/Autoproc32/autoPROC/bin/linux:/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/home/CAMPUS/Software/32bits/ccp4/ccp4-6.2.0/share/xia2/xia2core//Test:/home/CAMPUS/Software/32bits/ccp4/ccp4-6.2.0/share/xia2/xia2//Applications:/home/CAMPUS/Software/32bits/em2em:.

    So it is not the same at all...

  6. #6
    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: Set system $PATH in running environment

    The terminal might have a different content of environment variables. That's how environment variables work. If you start Creator from within this exact terminal and reset the variables like Chris told you, Creator will inherit PATH from its parent process.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  7. #7
    Join Date
    May 2011
    Posts
    17
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Set system $PATH in running environment

    I was starting creator from kde menu.
    Starting from the terminal make it works.
    Thanks a lot.

  8. #8
    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: Set system $PATH in running environment

    So the bottom line is that it is your terminal that has a different PATH than the "system PATH" (since KDE defines your system environment).
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Qt Creator PATH Environment Variable
    By dohzer in forum Qt Tools
    Replies: 3
    Last Post: 4th December 2010, 07:50
  2. Qt Creator Error running sample - wrong path for pythongdb
    By Asperamanca in forum Qt Tools
    Replies: 3
    Last Post: 6th October 2010, 21:33
  3. Replies: 8
    Last Post: 17th October 2009, 09:10
  4. System environment variable
    By fahlen in forum Qt Programming
    Replies: 4
    Last Post: 27th November 2007, 20:02
  5. Problen with add system environment.
    By Flake in forum Qt Programming
    Replies: 4
    Last Post: 6th September 2007, 15:12

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.