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. Add Parent Folder Environment Path
Forum Updated to NodeBB v4.3 + New Features

Add Parent Folder Environment Path

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 307 Views 1 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.
  • A Offline
    A Offline
    AmirHammoutene
    wrote on last edited by AmirHammoutene
    #1

    Hello,
    My program is constructed so there is 2 (and more) .exe :

    • One for the "menu", the one to be launch at start
    • One (and more) for the different app we want to use

    I'm wondering how to set the root folder as an environment path for the second .exe which will be placed in /apps folder from root so I don't have to duplicate the many .dll needed for the two (and more) .exe to work.

    To illustrate, I run the "tree" command from cmp
    Now I have that (and it works)

    ³   CreateCharacterSheet.exe
    ³   CreateCharacterSheet_fr.qm
    ³   icudt53.dll
    ³   icuin53.dll
    ³   icuuc53.dll
    ³   libgcc_s_dw2-1.dll
    ³   libstdc++-6.dll
    ³   libwinpthread-1.dll
    ³   Qt5Core.dll
    ³   Qt5Gui.dll
    ³   Qt5Widgets.dll
    ³   Qt5Xml.dll
    ³   RPGUniversalCharacterSheet.exe
    ³   RPGUniversalCharacterSheet_fr.qm
    ³   
    ÀÄÄÄplatforms
            qminimal.dll
            qoffscreen.dll
            qwindows.dll
    

    and I want that (but launching CreateCharacterSheet.exe won't work due to missed .dll):

    ³   icudt53.dll
    ³   icuin53.dll
    ³   icuuc53.dll
    ³   libgcc_s_dw2-1.dll
    ³   libstdc++-6.dll
    ³   libwinpthread-1.dll
    ³   Qt5Core.dll
    ³   Qt5Gui.dll
    ³   Qt5Widgets.dll
    ³   Qt5Xml.dll
    ³   RPGUniversalCharacterSheet.exe
    ³   RPGUniversalCharacterSheet_fr.qm
    ³   
    ÃÄÄÄapps
    ³       CreateCharacterSheet.exe
    ³       CreateCharacterSheet_fr.qm     
    ÀÄÄÄplatforms
            qminimal.dll
            qoffscreen.dll
            qwindows.dll
    

    Thank you for your response

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      If you are using QProcess you can use QProcess:: setProcessEnvironment

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      2
      • A Offline
        A Offline
        AmirHammoutene
        wrote on last edited by AmirHammoutene
        #3

        thank you,
        for information, i've done that :

                QProcess newProcess;
                QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
                env.insert("THIS_FOLDER", ".");
                newProcess.setProcessEnvironment(env);
                newProcess.startDetached(programPath);
        

        EDIT : the _qm (linguist) for the subexe needs to be placed in the root folder, unless you replace:

            QString locale = QLocale::system().name().section('_', 0, 0);// get system language
            QTranslator translator;
            translator.load(QString("CreateCharacterSheet_") + locale);
            a.installTranslator(&translator);
        

        by

            QString locale = QLocale::system().name().section('_', 0, 0);// get system language
            QTranslator translator;
            translator.load(QString("apps/CreateCharacterSheet_") + locale);
            a.installTranslator(&translator);
        

        solved

        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