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. Settings path in Lubuntu
Forum Updated to NodeBB v4.3 + New Features

Settings path in Lubuntu

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 3 Posters 501 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.
  • B Offline
    B Offline
    Bengt 0
    wrote on last edited by
    #1

    Hi,

    My Qt5 Application is designed to be cross-platform Win/Mac/Linux.
    I have currently very few or no conditionals between the platforms in the settings code, I am relying on the Qt5 behaviour.

    All works as expected under Win and Mac, but there is an "anomaly" under Linux.

    The application uses a system scope setting and a user scope setting.
    When opening the application as a regular user, the system scope settings are read-only.
    The system scope settings are stored in /etc/xdg/lubuntu/Mysoft/MyApp.ini.

    To change the system scope settings, my app is executed using "sudo MyApp" and then has write access to the system scope settings.
    However, then the settings path suddenly changes to /etc/xdg/Mysoft/MyApp.ini.
    Why is this? Can I change this behaviour?

    An alternative is to use a special administrative user account and change the ownership and write access of /etc/xdg/lubuntu/Mysoft and its contents to the special admin user. To me, it feels a bit ugly an unusual.

    I need some advice on how to do this the correct way.

    BN

    JonBJ 1 Reply Last reply
    0
    • B Bengt 0

      Hi,

      My Qt5 Application is designed to be cross-platform Win/Mac/Linux.
      I have currently very few or no conditionals between the platforms in the settings code, I am relying on the Qt5 behaviour.

      All works as expected under Win and Mac, but there is an "anomaly" under Linux.

      The application uses a system scope setting and a user scope setting.
      When opening the application as a regular user, the system scope settings are read-only.
      The system scope settings are stored in /etc/xdg/lubuntu/Mysoft/MyApp.ini.

      To change the system scope settings, my app is executed using "sudo MyApp" and then has write access to the system scope settings.
      However, then the settings path suddenly changes to /etc/xdg/Mysoft/MyApp.ini.
      Why is this? Can I change this behaviour?

      An alternative is to use a special administrative user account and change the ownership and write access of /etc/xdg/lubuntu/Mysoft and its contents to the special admin user. To me, it feels a bit ugly an unusual.

      I need some advice on how to do this the correct way.

      BN

      JonBJ Online
      JonBJ Online
      JonB
      wrote on last edited by
      #2

      @Bengt-0 said in Settings path in Lubuntu:

      To change the system scope settings, my app is executed using "sudo MyApp" and then has write access to the system scope settings.

      Unless your whole app is intended to be some kind of administrative one --- which I doubt --- this is a really bad idea. In fact, really bad!

      The obvious question is: why would your app want to have " write access to the system scope settings"? Why can your app not work under the assumption that system settings are read-only, only write to user scope, and thereby work across all platforms, even if the others allow write access denied under Linux?

      1 Reply Last reply
      2
      • mrjjM Offline
        mrjjM Offline
        mrjj
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi
        Is that a special ini file that must be placed there ?
        Else just use
        https://doc.qt.io/qt-5/qstandardpaths.html#details
        to get a writable location across platforms.

        B 1 Reply Last reply
        1
        • B Offline
          B Offline
          Bengt 0
          wrote on last edited by
          #4

          "why would your app want to have " write access to the system scope settings"? "
          Because someone should "set" the settings!
          If it is read-only for everyone, why have a system scope setting at all?

          The idea is that an admin user sets the application up properly, and then logs out.
          Then other users with less privs uses the application without the possibility to screw it up.

          1 Reply Last reply
          0
          • B Offline
            B Offline
            Bengt 0
            wrote on last edited by
            #5

            Unless there is a very good argument against it, I will probably use the method of admin ownership of the settings path and files. I have tested it and it works.
            Sorry for asking.

            1 Reply Last reply
            1
            • mrjjM mrjj

              Hi
              Is that a special ini file that must be placed there ?
              Else just use
              https://doc.qt.io/qt-5/qstandardpaths.html#details
              to get a writable location across platforms.

              B Offline
              B Offline
              Bengt 0
              wrote on last edited by
              #6

              @mrjj
              Yes, I have considered this, but not tested it.
              However, I am not sure how I can manage the different write access for system vs. user under Linux.
              In Windows, to do the system scope settings, I do "open as Administrator", and this works fine. The "sudo " was an attempt to do something similar but it did not work for the reasons described.

              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