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. get login name in qmake script
QtWS25 Last Chance

get login name in qmake script

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

    I am porting some Perl code to qmake. The Perl code gets the current login name with

    my($login_name) = lc getlogin;
    

    and uses that login name for replacing some text in a configuration file. I have translated the Perl code into a QMAKE_POST_LINK action that does the same textual replacement, but within my QMAKE_POST_LINK action i now also need that same login name.

    This should work on both Windows and Linux. Is there a way to get that login name in a qmake .pro file?

    See also https://perldoc.perl.org/functions/getlogin

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mchinand
      wrote on last edited by mchinand
      #2

      Something like this:

      MYUSERNAME=NO_USERNAME
      win32 {
      MYUSERNAME = $$(USERNAME)
      }
      unix {
      MYUSERNAME = $$(USER)
      }
      message(The username is $$MYUSERNAME)
      
      1 Reply Last reply
      0
      • B Offline
        B Offline
        Bart_Vandewoestyne
        wrote on last edited by
        #3

        Yes, thanks. That was also what I have figured out in the meanwhile :-)

        1 Reply Last reply
        1

        • Login

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